We should aim to have first-class citizen testing in our ecosystem. This is a bit premature considering we're missing more important things, but at least we should start thinking about how developers should write tests using noname.
Ideally, we should follow the modern pattern of
$ noname test
Also I think it's nice that in Golang tests are separated in their own files, and you just have to have _test.go in the filename to have a test file (great example of convention of configuration)
It would also be nice to have proptest/quickcheck integrated in the language. So for example my_module.test.no would get access to all private structs/fns/fields of my_module.no and would be written like that:
use std::testing;
fn test_something(tt: testing::State) {
// testing a function with real values
let out = some_fn(3, 6);
tt.assert(out == 5);
// testing main with real values
let arg = SomeStruct { some_field: 6 };
main(arg);
// with property test
let arg: SomeStruct = tt.gen();
if arg.some_field > 4 {
main(arg);
} else {
tt.should_fail { main(arg); }
}
}
a few problems:
property test is imperfect here, as we might want to have "strategies" on how to generate more interesting fields
the tt.should_fail { ... } syntax is weird, I don't want to introduce closures, so what is this?
We should aim to have first-class citizen testing in our ecosystem. This is a bit premature considering we're missing more important things, but at least we should start thinking about how developers should write tests using noname.
Ideally, we should follow the modern pattern of
Also I think it's nice that in Golang tests are separated in their own files, and you just have to have
_test.go
in the filename to have a test file (great example of convention of configuration)It would also be nice to have proptest/quickcheck integrated in the language. So for example
my_module.test.no
would get access to all private structs/fns/fields ofmy_module.no
and would be written like that:a few problems:
tt.should_fail { ... }
syntax is weird, I don't want to introduce closures, so what is this?