syntax_tests: allow to update tests, and don't use a regexp (#8589)

* syntax_tests: allow to "bless" tests, and don't use a regexp

A regexp was used at the beginning because I thought we would want to
allow error to contains things that were not predictable or that would
often change. But this is not the case¹. It is better to actually test
for the full error message

¹ well actually it was the case for path, but there is another substitution to 
 `📂` for the manifest directory

* syntax_tests: Bless the tests

* syntax_tests: Manual adjust after bless

Because there used to be comments on the same line of the message which
bless don't support

* Fix error message with path on windows

 - The debug implementation of path make double slash, that's not what
   we want to show the user
 - normalize paths to use `/` so the test passes
This commit is contained in:
Olivier Goffart 2025-06-02 16:47:33 +02:00 committed by GitHub
parent 05c2b38a52
commit 12393e21bd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
156 changed files with 701 additions and 418 deletions

View file

@ -2,18 +2,20 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
Test2 := Path {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
width: 640px;
height: 480px;
commands: "M 0 0 M -100 0 A 100 100 0 1 0 100 0 Å 100 100 0 1 0 100 0 Z";
// ^error{Error parsing SVG commands}
// ^error{Error parsing SVG commands (Number { src: "", line: 0, column: 37 })}
}
export TestCase := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
Path {
width: 100px;
height: 100px;
commands: "hello world";
// ^error{Error parsing SVG commands}
// ^error{Error parsing SVG commands (Number { src: "e", line: 0, column: 1 })}
stroke: red;
stroke-width: 1px;
}
@ -28,17 +30,17 @@ export TestCase := Rectangle {
width: 640px;
height: 480px;
commands: "M 0 0 M -100 0 A 100 100 0 1 0 0 A 100 100 0 1 0 100 0 Z";
// ^error{Error parsing SVG commands}
// ^error{Error parsing SVG commands (Number { src: "", line: 0, column: 33 })}
}
TouchArea {
clicked => {
p.commands = "M 0 0 M -100 0 A 100 100 0 1 0 100 0 A 100 100 0 1 0 100 0 Z";
// ^error{This special property can only be used to make a binding and cannot be accessed}
// ^error{This special property can only be used to make a binding and cannot be accessed}
}
}
Text { text: p.commands; }
// ^error{This special property can only be used to make a binding and cannot be accessed}
// ^error{This special property can only be used to make a binding and cannot be accessed}
Test2 {}