Skip to content
Sword

Testing

A file ending _test.sword beside your code holds its tests, and shield test finds them:

package strings
import "std/testing"
func TestTrimSpace(mut t *testing.T) !void {
t.Equal(TrimSpace(" ada "), "ada")
}
Terminal window
$ shield test std/strings
ok 6 tests (0ms)

Nothing registers a test: the name is enough. Testing is the rest of it.