Handy unils for writing tests in V language.
This lirary provides several assert_***
functions which enhance the possibilites
of builtin assert
statement, giving the colored diff of expected and gotten value.
When generic functions will be available in V, concrete assert_eq_str
and assert_eq_int
will
be replaced with one assert_eq
function.
The version of this module will remain in
0.x.x
unless the language API's are finalized and implemented.
import popzxc.vtest
fn test_fail_str() {
assert vtest.assert_eq_str("hello world", "hello wolrd")
}
fn test_fail_int() {
assert vtest.assert_eq_int(1000, 2000)
}
fn test_fail_true() {
assert vtest.assert_true(false)
}
fn test_fail_false() {
assert vtest.assert_false(true)
}
Via vpm:
v install popzxc.vtest
Via vpkg:
vpkg get https://github.com/popzxc/vtest
Feel free to open pull requests!