Skip to content

Running and Testing Code

Running a Program

To run a StellarTrails program, use the si binary followed by your script program:

./si myscript.stellartrails

Writing Your Own Tests

You can write your own .stellartrails files with built-in test features. Use the test keyword to define test cases and assert to check conditions.

Example:

test "addition works" {
    let result = 2 + 3
    assert result == 5
}

test "string concatenation" {
    let s = "hello, " + "world"
    assert s == "hello, world"
}

Run your test file with:

./si mytests.stellartrails

If all assertions pass, the script will complete without errors. If an assertion fails, you’ll see an error message. This allows you to write and run your own tests for any StellarTrails code you create.


Next: Next Steps