919 B
919 B
Sextest
A tool for testing sex compilator by using test programs. The tools compiles them using the compiler, then runs with provided input, then checks that the output and return code matches the test specification.
Test format
The test program consists of two sections: prelude and the test program itself. Prelude contains four sections: compilation parameters, such as flags to compiler; string to be passed to program's stdin; output to match against program's stdout; return code to match against what program returns. All sections start with respective name: :compilation, :stdout, :stdin, :return. Section names must be present, but all can be empty. Return code defaults to 0 in such case.
Example
some-test.sex:
; :compilation
; :stdin
; :stdout Hello world!
; :return
(include stdio.h)
(pub fn main () int
(puts "Hello World!")
(printf "Hello, %s!\n" name)
(return 0))