salient-lang / salient

http://salient-lang.dev/
MIT License
0 stars 0 forks source link

Testing framework #18

Closed AjaniBilby closed 5 months ago

AjaniBilby commented 5 months ago

Added primitive automated unit tests for salient, use the salient test command, then list all of the files or folders you want to test over. It will then look for all .test.sa files and compile the unit tests, then run them and validate they all return true.

Example test unit test file:

fn fib_recur(n: i32): i32 {
    if n <= 1 { return n; };
    return fib_recur(n - 1) + fib_recur(n - 2);
}

test "fibonacci recursive call" {
    if fib_recur(3) != 2 { return false; };

    return true;
}