test / before / after

Put native tests and their per-test hooks under src/test/kalm.

ExampleTests.kalm
before:
    sayLine("starting")

test "arithmetic works":
    expect 2 + 3 == 5

after:
    sayLine("finished")
ExampleTests.kalm
before {
    sayLine("starting")
}

test "arithmetic works" {
    expect 2 + 3 == 5
}

after {
    sayLine("finished")
}
ExampleTests.java
import static org.junit.jupiter.api.Assertions.*;

import org.junit.jupiter.api.*;

public class ExampleTests {
    @BeforeEach
    void before() {
        System.out.println("starting");
    }

    @Test
    void arithmeticWorks() {
        assertEquals(5, 2 + 3);
    }

    @AfterEach
    void after() {
        System.out.println("finished");
    }
}

Learn more.