Created: 2014-05-18 23:50
Updated: 2019-03-07 20:18


Portable tests for Suneido implementations.

Currently, there are implementations in cSuneido, jSuneido, gSuneido, suneido.js, and in Suneido (stdlib) itself.

Tests are defined in text files. They are read with the Suneido lexer.

A test file consists of multiple test cases for multiple fixtures.

@fixture2 // comment

A test case is ended by a newline, unless the line ends with a comma. Otherwise commas are optional and ignored.

Comments are allowed.

Fixtures must be defined in each implementation for each type of test, usually along with the other unit test code.



  • string, expected_type, expected_value
  • string, throws "exception substring"

Classes should have their content shown sorted by member.

Functions should have their parameters shown

@method // call a method

  • value, method, arg ..., expected

@method tests could be done with @execute, but @method doesn't require compiling and executing code.

@execute // compile and run

  • string, expected
  • string, "**notfalse**"
  • string, throws "exception substring"

There should be a function Def(name, value) which can be used to define globals - this is necessary to test classes. If the value is a string, it is compiled with the specified name - this is necessary to test privatization.


  • string, from, to, expected


  • string, pattern // should match
  • string, pattern, false // shouldn't match
  • string, pattern, \0, \1 ...

@dnum_add // check both ways
@dnum_sub // checks x - y = z and if z != 0 also y - x = -z
@dnum_mul // check both ways

  • number, number, expected

Round off the least significant decimal digit of the result before comparing.


  • value, value, value ...

Compares each value to all of the following values, both ways.


  • string, pos [, len], expected

Test [i ::], [i :: n], and [i ..] on strings and objects


  • string, start [, limit], expected

Test [start ..] and [start :: limit] on strings and objects


  • value, value, value ...

Compares each value to all of the following values, both ways.

Values must be strings that can be compiled to constants.


Same as @compare except it compares the values packed.

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more