tests: Move control sequences filtering to fish directly

This was an sh-script that just invoked fish again.

I can see how we could implement it in another language to avoid the
fish under test corrupting the results, but it literally invoked the
fish under test anyway.
This commit is contained in:
Fabian Boehm 2024-11-21 21:07:40 +01:00
parent 8dcde27e0b
commit 2d07aa2686
3 changed files with 18 additions and 15 deletions

View File

@ -0,0 +1,17 @@
#!/usr/bin/fish
# Remove the sorts of escape sequences interactive fish prints.
# First the enable sequences
set -l escapes "\e\[\?2004h"\
"\e\[>4;1m"\
"\e\[>5u"\
"\e="\
# or
"|"\
# the disable sequences
"\e\[\?2004l"\
"\e\[>4;0m"\
"\e\[<1u"\
"\e>"
cat | string replace -ra -- $escapes ''

View File

@ -1,14 +0,0 @@
#!/bin/sh
escape=$(printf '\033')
"$1" -c 'cat | string replace -ra $argv[1] ""' -- "\
""$escape\[\?2004h""\
""$escape\[>4;1m""\
""$escape\[>5u""\
""$escape=""\
""|""\
""$escape\[\?2004l""\
""$escape\[>4;0m""\
""$escape\[<1u""\
""$escape>"

View File

@ -42,7 +42,7 @@ if set -q files_to_test[1]
--progress $force_color \
-s fish=../test/root/bin/fish \
-s fish_test_helper=../test/root/bin/fish_test_helper \
-s filter-control-sequences='../tests/filter-control-sequences.sh ../test/root/bin/fish' \
-s filter-control-sequences='../test/root/bin/fish ../tests/filter-control-sequences.fish' \
$files_to_test
set -l littlecheck_status $status