Skip to content

Latest commit

 

History

History

lesstest

lesstest is a test suite for less. The lesstest program runs an
instance of less, but less's normal tty input instead comes from
a pipe leading from lesstest to less, and less's normal terminal
output instead goes to a pipe leading from less to an instance
of lt_screen. lt_screen simulates a terminal, but also has a
separate "dump channel" which allows lesstest to read the contents
of the simulated screen.

                +---------<---------<----------<---------<---------+
                |                                dump channel      |
                |                                                  |
                v (screen_out)                                     | (ttyout)
    +------------------+          (tty) +------+ (outfd)        +-------------+
    |     lesstest     |--------------->| less |--------------->|  lt_screen  |
    +------------------+   simulated    +------+    simulated   +-------------+
        ^ (stdin)   | ^        user                  terminal
        |           | |
        |           v | (testfile)
 +-----------+   +---------+
 | developer |   | LT file |
 +-----------+   +---------+

lesstest runs in one of two modes: 

In the "maketest" mode it reads single keystrokes from the developer 
and sends them to less. After each keystroke it then reads the 
lt_screen screen contents and logs the keystroke and the resulting 
screen contents to a log file, called an lt file. 

In the "runtest" mode, lesstest reads a previously-created lt file 
and "replays" the session; that is, it first reads a keystroke from 
the lt file and sends it to less. It then reads the lt_screen screen 
contents and compares it to the logged screen contents from the lt file.