Please tell me , how to execute unit-tests based on std.test
I modified the testcase from tests/pass/alternative.glu, changing final line to "run tests" (see below). But when I try to execute the file alternative.glu , the following error message shows up in console
$ gluon alternative.glu
error: Expected the following types to be equal
Expected: std.effect.Eff [| ... | a |] a
Found: forall r . std.test.TestCase r ()
2 errors were found during unification:
Row labels do not match.
Expected: Pure
Found: Test
Row labels do not match.
Expected: Impure
Found: Group
┌─ alternative:28:5
│
28 │ run tests
│ ^^^^^
Please can you explain, how to execute the group "tests" ?
let { run, Test, TestCase, assert_eq, test, group, ? } = import! std.test
let { (<|) } = import! std.function
let prelude @ { Alternative } = import! std.prelude
let { Applicative, (*>) } = import! std.applicative
let int = import! std.int
let list @ { ? }= import! std.list
let option = import! std.option
let { (<|>), or, empty } = import! std.alternative
let test_alt ?alt show eq : [Alternative f] -> Show (f Int) -> Eq (f Int) -> _ =
let { wrap } = alt.applicative
let assert = assert_eq ?show ?eq
[
test "empty equal" <| \_ -> (assert empty empty),
test "or selects non-empty" <| \_ -> (assert (empty <|> wrap 1) (wrap 1)),
test "empty <|> empty == empty" <| \_ -> (assert (empty <|> empty) empty),
test "or selects non-empty 2" <| \_ -> (assert (empty <|> empty <|> wrap 10) (wrap 10))
]
let tests: TestCase r () =
group "alternative" [
group "option" (test_alt option.show option.eq),
group "list" (test_alt list.show list.eq)
]
run tests
Please tell me , how to execute unit-tests based on std.test
I modified the testcase from tests/pass/alternative.glu, changing final line to "run tests" (see below). But when I try to execute the file alternative.glu , the following error message shows up in console
Please can you explain, how to execute the group "tests" ?