We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 30abbde commit dccde05Copy full SHA for dccde05
1 file changed
tests/src/Main.gren
@@ -3,13 +3,30 @@ module Main exposing (main)
3
import Expect
4
import Test exposing (describe, test)
5
import Test.Runner.Node exposing (Program, run)
6
+import Parser as P
7
8
9
10
main : Program
11
main =
12
run <|
13
describe "Parser Tests"
- [ test "TODO" <| \{} ->
14
- Expect.pass
+ [ describe "int"
15
+ [ test "Simple integer" <| \{} ->
16
+ P.run P.int "123456"
17
+ |> Expect.equal (Ok 123456)
18
+ , test "Failure case" <| \{} ->
19
+ P.run P.int "3.1415"
20
+ |> expectErr
21
+ ]
22
]
23
+
24
25
+expectErr : Result err ok -> Expect.Expectation
26
+expectErr result =
27
+ when result is
28
+ Err _ ->
29
+ Expect.pass
30
31
+ Ok _ ->
32
+ Expect.fail "I expected this test to fail with an Err case"
0 commit comments