diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2015-10-17 11:32:32 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2015-10-17 11:33:09 +0100 |
| commit | 832e9155fa95b7f98d3ce42e64b888588c1de8aa (patch) | |
| tree | 39494cc4d3b044b794ed71de95be62ec79d3a4b1 /test | |
| parent | 76fadd81081d7bb762d143dfd2ecca73637328a7 (diff) | |
Code cleanup in the test running script
Diffstat (limited to 'test')
| -rwxr-xr-x | test/run | 41 |
1 files changed, 13 insertions, 28 deletions
@@ -24,19 +24,20 @@ main() { kak_commands=" set global autoreload yes try %{ - source rc + source rc } try %{ - exec '%s%\(\K[^)]+<ret><c-s>ld<a-t>(hHdi<c-u><esc><c-o>' + exec '%s%\(\K[^)]+<ret><c-s>ld<a-t>(hHdi<c-u><esc><c-o>' } \ catch %{ - exec gg + exec gg } exec '$(cat cmd | sed -e s/\'/\\\\\'/g)' eval -buffer *debug* write debug - nop %sh{ IFS== - echo \"\$kak_selections\" > selections - echo \"\$kak_selections_desc\" > state + nop %sh{ + IFS== + echo \"\$kak_selections\" > selections + echo \"\$kak_selections_desc\" > state } write out quit! @@ -55,7 +56,12 @@ main() { echo diff -u $test/$dir/$expect $expect | while read -r line; do 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 done echo @@ -79,27 +85,6 @@ main() { # 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() { color_name=${1:-none} style_name=${2:-none} |
