This commit is contained in:
2026-03-24 21:19:03 +03:00
parent d039fa0cb9
commit a80b8d9acf
8 changed files with 150 additions and 5 deletions

34
tools/sextest/README.org Normal file
View File

@@ -0,0 +1,34 @@
* 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:
#+begin_src
; :compilation
; :stdin
; :stdout Hello world!
; :return
(include stdio.h)
(pub fn main () int
(puts "Hello World!")
(printf "Hello, %s!\n" name)
(return 0))
#+end_src