ucg/std/tests/schema_test.ucg
Jeremy Wall 6321828006 FEATURE: The begnnings of some schema definition utilities.
Also allow failure messages to be generated from any expression.
2019-01-20 08:32:05 -06:00

12 lines
349 B
Plaintext

let t = import "std/testing.ucg".asserts{};
let schema = import "std/schema.ucg";
assert t.ok{
test = schema.must(schema.one_of{val=1, types=["float", "int"]}, "Must be a float or an int"),
desc = "1 is an int",
};
assert t.not_ok{
test = schema.one_of{val=1, types=["float", "str"]}.result,
desc = "1 is not a float or string",
};