vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 3b56bd677ea38f0b3187572d18a425a940df85e0 parent 1881022b5f1bc1c482877b25f7cd392ba009effe Author: Josh Wainwright <josh.wainwright@ldra.com> Date: Mon, 25 Apr 2016 15:31:12 +0100 Remove .status files, just use .ref and .out pairs Diffstat:
| M | lua/Makefile | | | 2 | +- |
| M | lua/README.md | | | 18 | +++++------------- |
| M | lua/basic_cursor.lua | | | 2 | +- |
| A | lua/basic_cursor.ref | | | 15 | +++++++++++++++ |
| M | lua/basic_empty_file.lua | | | 2 | +- |
| A | lua/basic_empty_file.ref | | | 6 | ++++++ |
| M | lua/basic_file.lua | | | 2 | +- |
| A | lua/basic_file.ref | | | 10 | ++++++++++ |
| M | lua/getline.lua | | | 2 | +- |
| A | lua/getline.ref | | | 5 | +++++ |
| M | lua/test.sh | | | 9 | --------- |
11 files changed, 46 insertions(+), 27 deletions(-)
diff --git a/lua/Makefile b/lua/Makefile @@ -3,7 +3,7 @@ all: clean test clean: - rm -f *.out *.status *.err + rm -f *.out *.err test: @./test.sh diff --git a/lua/README.md b/lua/README.md @@ -1,21 +1,13 @@ Tests for vis specific lua api ------------------------------ -There are two types of lua tests here: - -1. Tests are formed from a `<test>.in`, `<test>.ref` and `<test>.out` triplet. - The `<test>.in` file is opened by vis, some operatations are performed and - the modified file is written to `<test>.out`. The new `<test>.out` is - compared to `<test>.ref` and the test passes if they are identical. - -2. Tests are formed from a single `<test>.status` file. This file is created by - the lua code in the test. It contains a single line per test case, this - single line should be `true` if the test case passed. The `<test>.status` - file is checked to ensure it contains only `true` lines and if so, the test - passes. +Tests are formed from a `<test>.in`, `<test>.ref` and `<test>.out` triplet. +The `<test>.in` file is opened by vis, some operatations are performed and the +modified file is written to `<test>.out`. The new `<test>.out` is compared to +`<test>.ref` and the test passes if they are identical. The shell script `test.sh` looks for a file with extension `.in`, eg `test.in`, and opens it in vis. The corresponding lua file, `test.lua`, is executed and is -expected to create either a `test.out` or `test.status` file. +expected to create a `test.out` file. Type `make` to run all tests. diff --git a/lua/basic_cursor.lua b/lua/basic_cursor.lua @@ -29,4 +29,4 @@ delete(win, '%') for i, res in pairs(results) do append(win, i-1, tostring(res)) end -vis:command('w! basic_cursor.status') +vis:command('w! basic_cursor.out') diff --git a/lua/basic_cursor.ref b/lua/basic_cursor.ref @@ -0,0 +1,15 @@ +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true diff --git a/lua/basic_empty_file.lua b/lua/basic_empty_file.lua @@ -12,4 +12,4 @@ delete(win, '%') for i = 1, #results do append(win, i-1, tostring(results[i])) end -vis:command('w! basic_empty_file.status') +vis:command('w! basic_empty_file.out') diff --git a/lua/basic_empty_file.ref b/lua/basic_empty_file.ref @@ -0,0 +1,6 @@ +true +true +true +true +true +true diff --git a/lua/basic_file.lua b/lua/basic_file.lua @@ -12,4 +12,4 @@ delete(win, '%') for i = 1, #results do append(win, i-1, tostring(results[i])) end -vis:command('w! basic_file.status') +vis:command('w! basic_file.out') diff --git a/lua/basic_file.ref b/lua/basic_file.ref @@ -0,0 +1,10 @@ +true +true +true +true +true +true +true +true +true +true diff --git a/lua/getline.lua b/lua/getline.lua @@ -14,4 +14,4 @@ delete(win, '%') for i = 1, #results do append(win, i-1, tostring(results[i])) end -vis:command('w getline.status') +vis:command('w getline.out') diff --git a/lua/getline.ref b/lua/getline.ref @@ -0,0 +1,5 @@ +true +true +true +true +true diff --git a/lua/test.sh b/lua/test.sh @@ -30,15 +30,6 @@ for t in $test_files; do printf "FAIL\n" diff -u "$t".ref "$t".out > "$t".err fi - elif [ -e "$t".status ]; then - if ! grep -v true "$t".status > /dev/null; then - printf "PASS\n" - TESTS_OK=$((TESTS_OK + 1)) - else - printf "FAIL\n" - printf "%s\n" "$t" > "$t".err - grep -vn true "$t".status >> "$t".err - fi else printf "FAIL\n" fi