@@ -21,18 +21,30 @@ specs = describe "parseSgf" $ for_ cases test
21
21
assertion = parseSgf input `shouldBe` fmap fromList <$> expected
22
22
23
23
cases = [ (" " , Nothing )
24
+ -- error: tree with no nodes
24
25
, (" ()" , Nothing )
26
+ -- error: node without tree
25
27
, (" ;" , Nothing )
28
+ -- error: node without properties
26
29
, (" (;)" , Just $ Node [] [] )
30
+ -- single-node tree
27
31
, (" (;A[B])" , Just $ Node [(" A" , [" B" ])] [] )
32
+ -- multiple properties
28
33
, (" (;A[b]C[d])" , Just $ Node [(" A" , [" b" ]), (" C" , [" d" ])] [] )
34
+ -- error: properties without value
29
35
, (" (;A)" , Nothing )
36
+ -- error: lowercase property identifier
30
37
, (" (;a[b])" , Nothing )
38
+ -- error: mixed-case property identifier
31
39
, (" (;Aa[b])" , Nothing )
40
+ -- two nodes
32
41
, (" (;A[B];B[C])" , Just $ Node [(" A" , [" B" ])] [ Node [(" B" , [" C" ])] [] ] )
42
+ -- two child trees
33
43
, (" (;A[B](;B[C])(;C[D]))" , Just $ Node [(" A" , [" B" ])] [ Node [(" B" , [" C" ])] []
34
44
, Node [(" C" , [" D" ])] [] ] )
45
+ -- multiple property values
35
46
, (" (;A[b][c][d])" , Just $ Node [(" A" , [" b" , " c" , " d" ])] [] )
47
+ -- escaped property value
36
48
, (" (;A[\\ ]b\n c\\\n d\t\t e\\\\ \\\n\\ ]])" , Just $ Node [(" A" , [" ]b cd e\\ ]" ])] [] ) ]
37
49
38
50
-- b74debc3be24b5c81650189935c9bbfa019b367e
0 commit comments