@@ -30,9 +30,10 @@ public function testErrorSnippetPointsAtPosition(): void
3030 $ node = $ doc ->value ->properties [1 ]->value ;
3131
3232 $ result = Maml::errorSnippet ($ source , $ node ->span ->start , 'Invalid value ' );
33- $ this ->assertStringContainsString ('Invalid value on line 3. ' , $ result );
34- $ this ->assertStringContainsString ('timeout: -1 ' , $ result );
35- $ this ->assertStringContainsString ('^ ' , $ result );
33+ $ this ->assertSame (
34+ "Invalid value on line 3. \n\n timeout: -1 \n ...........^ \n" ,
35+ $ result ,
36+ );
3637 }
3738
3839 public function testErrorSnippetAtStartOfSource (): void
@@ -41,9 +42,10 @@ public function testErrorSnippetAtStartOfSource(): void
4142 $ doc = Maml::parseAst ($ source );
4243
4344 $ result = Maml::errorSnippet ($ source , $ doc ->value ->span ->start , 'Expected object ' );
44- $ this ->assertStringContainsString ('Expected object on line 1. ' , $ result );
45- $ this ->assertStringContainsString ('null ' , $ result );
46- $ this ->assertStringContainsString ('^ ' , $ result );
45+ $ this ->assertSame (
46+ "Expected object on line 1. \n\n null \n ^ \n" ,
47+ $ result ,
48+ );
4749 }
4850
4951 public function testErrorSnippetOnNestedNode (): void
@@ -58,7 +60,9 @@ public function testErrorSnippetOnNestedNode(): void
5860 $ countNode = $ inner ->properties [1 ]->value ;
5961
6062 $ result = Maml::errorSnippet ($ source , $ countNode ->span ->start , 'Count must be positive ' );
61- $ this ->assertStringContainsString ('Count must be positive on line 3. ' , $ result );
62- $ this ->assertStringContainsString ('^ ' , $ result );
63+ $ this ->assertSame (
64+ "Count must be positive on line 3. \n\n {name: \"x \", count: 0} \n .......................^ \n" ,
65+ $ result ,
66+ );
6367 }
6468}
0 commit comments