@@ -121,11 +121,114 @@ public void multiplePropertyValues() throws SgfParsingException {
121121
122122 @ Test
123123 @ Disabled ("Remove to run test" )
124- public void escapedProperty () throws SgfParsingException {
125- String input = "(;A[\\ ]b \n c \n d \t \t e \n \\ ] ])" ;
126- SgfNode expected = new SgfNode (Map .of ("A" , List .of ("]b \n c \n d \t \t e \n ] " )));
124+ public void withinPropertyValueWhitespace () throws SgfParsingException {
125+ String input = "(;A[hello \t \t world ])" ;
126+ SgfNode expected = new SgfNode (Map .of ("A" , List .of ("hello world " )));
127127 SgfNode actual = new SgfParsing ().parse (input );
128128 assertThat (actual ).isEqualTo (expected );
129129 }
130130
131+ @ Test
132+ @ Disabled ("Remove to run test" )
133+ public void withinPropertyValueNewline () throws SgfParsingException {
134+ String input = "(;A[hello\n \n world])" ;
135+ SgfNode expected = new SgfNode (Map .of ("A" , List .of ("hello\n \n world" )));
136+ SgfNode actual = new SgfParsing ().parse (input );
137+ assertThat (actual ).isEqualTo (expected );
138+ }
139+
140+ @ Test
141+ @ Disabled ("Remove to run test" )
142+ public void escapedClosingBracket () throws SgfParsingException {
143+ String input = "(;A[\\ ]])" ;
144+ SgfNode expected = new SgfNode (Map .of ("A" , List .of ("]" )));
145+ SgfNode actual = new SgfParsing ().parse (input );
146+ assertThat (actual ).isEqualTo (expected );
147+ }
148+
149+ @ Test
150+ @ Disabled ("Remove to run test" )
151+ public void escapedBacklash () throws SgfParsingException {
152+ String input = "(;A[\\ \\ ])" ;
153+ SgfNode expected = new SgfNode (Map .of ("A" , List .of ("\\ " )));
154+ SgfNode actual = new SgfParsing ().parse (input );
155+ assertThat (actual ).isEqualTo (expected );
156+ }
157+
158+ @ Test
159+ @ Disabled ("Remove to run test" )
160+ public void openingBracketNeedNotToBeEscaped () throws SgfParsingException {
161+ String input = "(;A[x[y\\ ]z][foo]B[bar];C[baz])" ;
162+ SgfNode expected = new SgfNode (Map .of ("A" , List .of ("x[y]z" , "foo" ),
163+ "B" , List .of ("bar" )),
164+ List .of (
165+ new SgfNode (Map .of ("C" , List .of ("baz" )))
166+ ));
167+ SgfNode actual = new SgfParsing ().parse (input );
168+ assertThat (actual ).isEqualTo (expected );
169+ }
170+
171+ @ Test
172+ @ Disabled ("Remove to run test" )
173+ public void semicolonNeedNotToBeEscaped () throws SgfParsingException {
174+ String input = "(;A[a;b][foo]B[bar];C[baz])" ;
175+ SgfNode expected = new SgfNode (Map .of ("A" , List .of ("a;b" , "foo" ),
176+ "B" , List .of ("bar" )),
177+ List .of (
178+ new SgfNode (Map .of ("C" , List .of ("baz" )))
179+ ));
180+ SgfNode actual = new SgfParsing ().parse (input );
181+ assertThat (actual ).isEqualTo (expected );
182+ }
183+
184+ @ Test
185+ @ Disabled ("Remove to run test" )
186+ public void paranthesesNeedNotToBeEscaped () throws SgfParsingException {
187+ String input = "(;A[x(y)z][foo]B[bar];C[baz])" ;
188+ SgfNode expected = new SgfNode (Map .of ("A" , List .of ("x(y)z" , "foo" ),
189+ "B" , List .of ("bar" )),
190+ List .of (
191+ new SgfNode (Map .of ("C" , List .of ("baz" )))
192+ ));
193+ SgfNode actual = new SgfParsing ().parse (input );
194+ assertThat (actual ).isEqualTo (expected );
195+ }
196+
197+ @ Test
198+ @ Disabled ("Remove to run test" )
199+ public void escapedTab () throws SgfParsingException {
200+ String input = "(;A[hello\\ \t world])" ;
201+ SgfNode expected = new SgfNode (Map .of ("A" , List .of ("hello world" )));
202+ SgfNode actual = new SgfParsing ().parse (input );
203+ assertThat (actual ).isEqualTo (expected );
204+ }
205+
206+ @ Test
207+ @ Disabled ("Remove to run test" )
208+ public void escapedNewline () throws SgfParsingException {
209+ String input = "(;A[hello\\ \n world])" ;
210+ SgfNode expected = new SgfNode (Map .of ("A" , List .of ("helloworld" )));
211+ SgfNode actual = new SgfParsing ().parse (input );
212+ assertThat (actual ).isEqualTo (expected );
213+ }
214+
215+
216+ @ Test
217+ @ Disabled ("Remove to run test" )
218+ public void escapedTAndN () throws SgfParsingException {
219+ String input = "(;A[\\ t = t and \\ n = n])" ;
220+ SgfNode expected = new SgfNode (Map .of ("A" , List .of ("t = t and n = n" )));
221+ SgfNode actual = new SgfParsing ().parse (input );
222+ assertThat (actual ).isEqualTo (expected );
223+ }
224+
225+
226+ @ Test
227+ @ Disabled ("Remove to run test" )
228+ public void mixOfEscapedCharactersAndWhitespaces () throws SgfParsingException {
229+ String input = "(;A[\\ ]b\n c\\ \n d\t \t e\\ \\ \\ \n \\ ]])" ;
230+ SgfNode expected = new SgfNode (Map .of ("A" , List .of ("]b\n cd e\\ ]" )));
231+ SgfNode actual = new SgfParsing ().parse (input );
232+ assertThat (actual ).isEqualTo (expected );
233+ }
131234}
0 commit comments