Close

Tests

A project log for Argentum programming language

It automatically prevents all memory leaks. It doesn't use GC, so no pauses. It's compiled to machine code. It's crazy safe and fast.

andrey-kalmatskiyAndrey Kalmatskiy 02/14/2025 at 23:580 Comments

Argentum got a special syntax to define tests right in the source files along with a code that needs to be tested, and a special mode of compilation, designed to support those tests.

using json;
using tests { assert }
...
class MyClass { ... }
fn myFn(s str) int { ... }

test myFnTest (){                              //<-- test
   assert(myFn("Some input data") == 42);
   ...
}

log("application started {myFn("some real data")}");

If launched as usual it completely skips tests in the source code and build the application itself.

But if add a command line key `-T "my.*Test"`  it ignores main entry point and instead build an app containing all tests matching the given regexp.

It also supports mocks and test-specific fns/classes.

More details here: https://aglang.org/tests/

Discussions