Will there be built in testing support like in Zig or Rust?

Something Rust makes very easy to set up is testing, and Zig makes this even easier by just having test "name" { ... } declarations. The less friction there is for good practices like this the more people tend to do it. Would something like this be considered for mojo at some point?
12 Replies
ksandvik
ksandvik13mo ago
Please provide this suggestion to https://github.com/modularml/mojo/ for future consideration.
GitHub
GitHub - modularml/mojo: The Mojo Programming Language
The Mojo Programming Language. Contribute to modularml/mojo development by creating an account on GitHub.
TeamPuzel
TeamPuzel13mo ago
GitHub
Built in testing support, like Rust or Zig · modularml mojo · Discu...
Having tests as a language feature greatly reduces friction required to write and maintain them as they can exist right alongside code they are testing. Personally I often avoid tests in languages ...
JIMC
JIMC13mo ago
@TeamPuzel you use zig?
TeamPuzel
TeamPuzel13mo ago
Yeah
JIMC
JIMC13mo ago
do u also use rust? which do u prefer more? recently i see bun is written in zig
TeamPuzel
TeamPuzel13mo ago
You mean Zig?
JIMC
JIMC13mo ago
sorry typo
TeamPuzel
TeamPuzel13mo ago
Zig is very simple and makes it easy to work with things like WebAssembly without any dependencies. I like Rust a lot too but it's more difficult to do that Zig doesn't have traits which is often annoying
JIMC
JIMC13mo ago
would u recommend people to learn zig? oh then how does zig achieve polymorphism?
TeamPuzel
TeamPuzel13mo ago
Yeah it's a cool language, like a more modern version of C The only way to do polymorphism is to manually write the vtables or use tagged unions
JIMC
JIMC13mo ago
omg writing the vtables and tagged unions? thats real bad
TeamPuzel
TeamPuzel13mo ago
Yeah it's not intended to be Rust, it's meant to be C But I mentioned it here because it has a very nice testing feature.
Want results from more Discord servers?
Add your server