TestRunner.run() doesn't run testst?

37 Views Asked by At

I have created a 'Hello World' type test suite, but I can't seem to have it run any tests. When executed, it simply says:

reached run function

Process finished with exit code 0

I can thus tell that my two functions containing tests are never executed, as they contain print statements that are never printed.

This is the source code of my tests/run.ceylon file:

import ceylon.test {
    TestRunner, createTestRunner
}


Anything myTests1 () {
    // assert something true!
    assert(40 + 2 == 42);
    print("myTests1");
    return null;
}

void myTests2 () {
    // assert something false!
    assert(2 + 2 == 54);
    print("myTests2");
}


"Run the module `tests`."
shared void run() {

    print("reached run function");

    TestRunner myTestRunner = createTestRunner(
        [`function myTests1`, `function myTests2`]);

    myTestRunner.run();
}
1

There are 1 best solutions below

0
On BEST ANSWER

the test function has to be annotated with test annotation, see https://modules.ceylon-lang.org/repo/1/ceylon/test/1.3.3.1/module-doc/api/index.html#start