4

If I want to start all tests within a module, I simply write:

> import Example;
> :test

and all of the test bool functions run. However, I want to start them using the Rascal .jar for CI purposes. Is there any flag that I can use? For example:

$ rascal.jar TestsModule --test

Or any alternative solution so I can run my Rascal tests for CI purposes?

1 Answers1

3

At the moment, not yet from the command line. For the (almost finished) compiler backend we now have --rascalTests <modules> but for now that won't solve your problem.

If your CI supports JUnit style tests, we have added a JUnit compatible layer around the rascal tests. For example this class runs all the tests in the Rascal modules in the lang::rascal::tests::basic package.

Another way to make it work is to pipe commands into the rascal-shell?

$ echo -e "import IO;\n println(\"Hello World\");\n:quit\n" | java -jar rascal-shell-unstable.jar
Version: 0.8.0.201604121603
rascal>import IO;
ok
rascal> println("Hello World");
Hello World
ok
rascal>:quit
Quiting REPL
$
Davy Landman
  • 15,109
  • 6
  • 49
  • 73
  • 1
    `--rascalTests` will be awesome. For now I did a small static code analysis function that executes on a pre-commit hook and generates a rascal module that calls all the tests and collects their result. However, I'll look into the Java class solution you pointed out. Thanks! – Yoan-Alexander Grigorov Apr 17 '16 at 19:47
  • if you want, you could try to add it to the [rascal-shell project](https://github.com/usethesource/rascal-shell/) and make a pull request, it will be some puzzling, so you could start with the pull request and get some feedback on the way. – Davy Landman Apr 18 '16 at 10:05
  • What I did is pretty simple hack ([BuildTests.rsc](https://github.com/BulgariaPHP/glagol-dsl/blob/master/src/BuildTests.rsc)), I am not confident that it is generic enough for the REPL. At least it helps me and it is good enough to run with my CI builds. – Yoan-Alexander Grigorov Apr 24 '16 at 15:54