aboutsummaryrefslogtreecommitdiff
path: root/sam/README.md
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2017-01-12 21:19:59 +0100
committerMarc André Tanner <mat@brain-dump.org>2017-01-12 21:19:59 +0100
commite6d4c35a80b2aed4a0b60ba9d32599545e0a36fd (patch)
tree4094e0894ae18a2bd64396aa4ac7883e50100965 /sam/README.md
parent72e2b4619ce5a7419de63efed1017b265ca9b7ce (diff)
downloadvis-e6d4c35a80b2aed4a0b60ba9d32599545e0a36fd.tar.gz
vis-e6d4c35a80b2aed4a0b60ba9d32599545e0a36fd.tar.xz
test/sam: adapt tests to new grouping semantics
Diffstat (limited to 'sam/README.md')
-rw-r--r--sam/README.md49
1 files changed, 21 insertions, 28 deletions
diff --git a/sam/README.md b/sam/README.md
index 64b14e2..83cf2af 100644
--- a/sam/README.md
+++ b/sam/README.md
@@ -3,8 +3,10 @@ Tests for vis - structural regular expression support
We test the structural regular expression implementation by supplying
the same command to both vis and [sam](http://sam.cat-v.org/). More
-concretely, we use `ssam(1)` the non-graphical streaming interface to
-sam. These tests are intended to be run on a system with
+concretely, we use a `ssam(1)` like script drive the non-graphical
+streaming interface of sam.
+
+These tests are intended to be run on a system with
[9base](http://tools.suckless.org/9base) or
[plan9port](https://swtch.com/plan9port/) installed.
@@ -19,50 +21,39 @@ when writing tests:
infrastructure.
* _different semantics_: some language constructs have slightly
- different semantics. Of particular relevance is the different grouping
- implementation. In sam each command of a group is executed with
- the same initial file state and all changes are later applied in parallel
- (if no conflict occurred and all changes were in sequence). Whereas
- vis applies the changes immediately and subsequent commands will
- operate on the modified file content.
+ different semantics. As an example in `sam` searches wrap around
+ while in `vis` they stop at the start/end of the file.
- As a consequence the following snippet to swap two words does currently
- not work in vis:
+ * _changes need to be in sequence_: sam will reject changes which are not
+ in sequence (i.e. all changes need to be performed in monotonically
+ increasing file position). The following will not work:
```
- ,x/[a-zA-Z]+/{
- g/Emacs/ v/....../ c/vi/
- g/vi/ v/.../ c/Emacs/
+ ,x/pattern/ {
+ a/</
+ i/>/
}
+ ?changes not in sequence
```
- This is particularly relevant for the tests because they are all
- executed in an implicit group.
-
- * _changes need to be in sequence_: sam will reject changes which are not
- in sequence (i.e. all changes need to be performed in ascending file
- position). The following will not work:
+ In contrast vis only requires that the changes are non-overlapping.
+ The above works as expected, but the following is rejected:
```
- {
- 10d
- 5d
+ ,x/pattern/ {
+ c/foo/
+ c/bar/
}
?changes not in sequence
```
- However, due to the aforementioned vis grouping semantics, swapping
- the line numbers around, will not produce the same result either
- (line 5 will already be deleted by the time the address of line 10
- is evaluated, thus the original line 11 will be deleted instead).
-
* _spurious white spaces_: in sam an empty line/command affects the
dot (current range to operate on), namely it is extended to cover
the whole line. However in vis we ignore all white space between
commands. In order to avoid differing behavior avoid spurious white
space between your commands in the test cases.
-For now the tests need to take these quirks into account, some of the
+For now the tests need to take these differences into account, some of the
vis behavior might be changed in the future.
A test constitutes of 3 files, the first 2 of which are mandatory:
@@ -74,6 +65,8 @@ A test constitutes of 3 files, the first 2 of which are mandatory:
* `test.ref` if omitted, the output from sam will be considered as
reference.
+All commands of a `test.cmd` are executed in an implicit group `.{ ... }`.
+
The top level shell script `test.sh` looks for these files in sub
directories, executes both editors and compares the resulting output.