Want to contribute? Fork us in GitHub!

Unit Testing with 'eoc'

There is eoc, a command line tool that helps you automate compilation, transpilation, and execution of simple EO programms. With this tool you can also create and execute unit tests. Just name them *-test.eo and add metas +junit to them.

Say, you have a program.eo file, which does this:

[] > name
  "Jeff Lebowski" > @
[args...] > program
  QQ.io.stdout > @
    name

You may want to create a unit test, which will check that your object name actually is the right name. Put it into the program-test.eo file (actually, you can pick any name of the file you like):

+junit
+alias name
+alias org.eolang.hamcrest.assert-that

[] > the-name-is-right
  assert-that > @
    name.length
    $.all-of
      $.greater-than 10
      $.less-than 100

Then, simply say:

$ eoc test

The test will be found and executed.