Skip to content

Commit 736d2d2

Browse files
committed
sgf-parsing: Explain all current test cases
It may otherwise be too cryptic why some of these things are errors #1025
1 parent aa6acee commit 736d2d2

File tree

1 file changed

+12
-0
lines changed
  • exercises/practice/sgf-parsing/test

1 file changed

+12
-0
lines changed

exercises/practice/sgf-parsing/test/Tests.hs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,30 @@ specs = describe "parseSgf" $ for_ cases test
2121
assertion = parseSgf input `shouldBe` fmap fromList <$> expected
2222

2323
cases = [ ("" , Nothing )
24+
-- error: tree with no nodes
2425
, ("()" , Nothing )
26+
-- error: node without tree
2527
, (";" , Nothing )
28+
-- error: node without properties
2629
, ("(;)" , Just $ Node [] [] )
30+
-- single-node tree
2731
, ("(;A[B])" , Just $ Node [("A", ["B"])] [] )
32+
-- multiple properties
2833
, ("(;A[b]C[d])" , Just $ Node [("A", ["b"]), ("C", ["d"])] [] )
34+
-- error: properties without value
2935
, ("(;A)" , Nothing )
36+
-- error: lowercase property identifier
3037
, ("(;a[b])" , Nothing )
38+
-- error: mixed-case property identifier
3139
, ("(;Aa[b])" , Nothing )
40+
-- two nodes
3241
, ("(;A[B];B[C])" , Just $ Node [("A", ["B"])] [ Node [("B", ["C"])] [] ] )
42+
-- two child trees
3343
, ("(;A[B](;B[C])(;C[D]))" , Just $ Node [("A", ["B"])] [ Node [("B", ["C"])] []
3444
, Node [("C", ["D"])] [] ] )
45+
-- multiple property values
3546
, ("(;A[b][c][d])" , Just $ Node [("A", ["b", "c", "d" ])] [] )
47+
-- escaped property value
3648
, ("(;A[\\]b\nc\\\nd\t\te\\\\ \\\n\\]])", Just $ Node [("A", ["]b cd e\\ ]"])] [] ) ]
3749

3850
-- b74debc3be24b5c81650189935c9bbfa019b367e

0 commit comments

Comments
 (0)