Skip to content

Commit dccde05

Browse files
committed
Wrote some tests
1 parent 30abbde commit dccde05

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

tests/src/Main.gren

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,30 @@ module Main exposing (main)
33
import Expect
44
import Test exposing (describe, test)
55
import Test.Runner.Node exposing (Program, run)
6+
import Parser as P
67

78

89

910
main : Program
1011
main =
1112
run <|
1213
describe "Parser Tests"
13-
[ test "TODO" <| \{} ->
14-
Expect.pass
14+
[ 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+
]
1522
]
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

Comments
 (0)