diff --git a/tests/filter-control-sequences.fish b/tests/filter-control-sequences.fish new file mode 100755 index 000000000..6797f4a22 --- /dev/null +++ b/tests/filter-control-sequences.fish @@ -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 '' diff --git a/tests/filter-control-sequences.sh b/tests/filter-control-sequences.sh deleted file mode 100755 index ea7b04a61..000000000 --- a/tests/filter-control-sequences.sh +++ /dev/null @@ -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>" diff --git a/tests/test.fish b/tests/test.fish index ec3b49916..eac2b8eaf 100644 --- a/tests/test.fish +++ b/tests/test.fish @@ -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