vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

README.md

(2733B)


      1 Tests for vis - structural regular expression support
      2 -----------------------------------------------------
      3 
      4 We test the structural regular expression implementation by supplying
      5 the same command to both vis and [sam](http://sam.cat-v.org/). More
      6 concretely, we use a `ssam(1)` like script drive the non-graphical
      7 streaming interface of sam.
      8 
      9 These tests are intended to be run on a system with
     10 [9base](http://tools.suckless.org/9base) or
     11 [plan9port](https://swtch.com/plan9port/) installed.
     12 
     13 However, be aware that there exist some incompatibilities between the
     14 implementation in sam and vis which need to be taken into account
     15 when writing tests:
     16 
     17  * _missing commands_: vis does currently deliberately not implement
     18    some commands available in sam (e.g. `m`, `t`, `=` `=#`, `k`, `u`).
     19    Additionally the commands operating on multiple files are either
     20    not implemented or currently not supported by the testing
     21    infrastructure.
     22 
     23  * _different semantics_: some language constructs have slightly
     24    different semantics. As an example in `sam` searches wrap around
     25    while in `vis` they stop at the start/end of the file.
     26 
     27  * _changes need to be in sequence_: sam will reject changes which are not
     28    in sequence (i.e. all changes need to be performed in monotonically
     29    increasing file position). The following will not work:
     30 
     31     ```
     32     ,x/pattern/ {
     33         a/</
     34         i/>/
     35     }
     36     ?changes not in sequence
     37     ```
     38 
     39    In contrast vis only requires that the changes are non-overlapping.
     40    The above works as expected, but the following is rejected:
     41 
     42     ```
     43     ,x/pattern/ {
     44         c/foo/
     45         c/bar/
     46     }
     47     ?changes not in sequence
     48     ```
     49 
     50  * _spurious white spaces_: in sam an empty line/command affects the
     51    dot (current range to operate on), namely it is extended to cover
     52    the whole line. However in vis we ignore all white space between
     53    commands. In order to avoid differing behavior avoid spurious white
     54    space between your commands in the test cases.
     55 
     56 For now the tests need to take these differences into account, some of the
     57 vis behavior might be changed in the future.
     58 
     59 A test constitutes of 3 files, the first 2 of which are mandatory:
     60 
     61  * `test.in` the file/buffer content with which the editor is started
     62  * `test.cmd` a file containing the structural regular expression
     63     command as you would type it in vis at the `:`-prompt or pass to
     64     `ssam(1)`.
     65  * `test.ref` if omitted, the output from sam will be considered as
     66     reference. 
     67 
     68 All commands of a `test.cmd` are executed in an implicit group `.{ ... }`.
     69 
     70 The top level shell script `test.sh` looks for these files in sub
     71 directories, executes both editors and compares the resulting output.
     72 
     73 Type `make` to run all tests.