Code cleanup in the test running script
This commit is contained in:
parent
76fadd8108
commit
832e9155fa
31
test/run
31
test/run
|
@ -34,7 +34,8 @@ main() {
|
||||||
}
|
}
|
||||||
exec '$(cat cmd | sed -e s/\'/\\\\\'/g)'
|
exec '$(cat cmd | sed -e s/\'/\\\\\'/g)'
|
||||||
eval -buffer *debug* write debug
|
eval -buffer *debug* write debug
|
||||||
nop %sh{ IFS==
|
nop %sh{
|
||||||
|
IFS==
|
||||||
echo \"\$kak_selections\" > selections
|
echo \"\$kak_selections\" > selections
|
||||||
echo \"\$kak_selections_desc\" > state
|
echo \"\$kak_selections_desc\" > state
|
||||||
}
|
}
|
||||||
|
@ -55,7 +56,12 @@ main() {
|
||||||
echo
|
echo
|
||||||
diff -u $test/$dir/$expect $expect | while read -r line; do
|
diff -u $test/$dir/$expect $expect | while read -r line; do
|
||||||
first_character=$(echo "$line" | cut -b 1)
|
first_character=$(echo "$line" | cut -b 1)
|
||||||
color=$(match $first_character + green - red @ magenta none)
|
case $first_character in
|
||||||
|
+) color=green ;;
|
||||||
|
-) color=red ;;
|
||||||
|
@) color=magenta ;;
|
||||||
|
*) color=none ;;
|
||||||
|
esac
|
||||||
echo "$line" | colorize $color normal
|
echo "$line" | colorize $color normal
|
||||||
done
|
done
|
||||||
echo
|
echo
|
||||||
|
@ -79,27 +85,6 @@ main() {
|
||||||
|
|
||||||
# Utility ├─────────────────────────────────────────────────────────────────────
|
# Utility ├─────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
match() {
|
|
||||||
expression="$1";
|
|
||||||
shift
|
|
||||||
while [ $# > 0 ]; do
|
|
||||||
pattern="$1"
|
|
||||||
shift
|
|
||||||
value="$1"
|
|
||||||
next="$1"
|
|
||||||
default_value="$pattern"
|
|
||||||
if [ -z "$next" ]; then
|
|
||||||
echo $default_value
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
if [ "$expression" = "$pattern" ]; then
|
|
||||||
echo "$value"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
get_ansi_code() {
|
get_ansi_code() {
|
||||||
color_name=${1:-none}
|
color_name=${1:-none}
|
||||||
style_name=${2:-none}
|
style_name=${2:-none}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user