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,10 +2,12 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
Abc := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
function par() {}
}
export Xxx := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
function fooo(a: int, a: int) -> int { return a; }
// ^error{Duplicated argument name 'a'}

View file

@ -12,6 +12,7 @@ global Glob {
}
Comp := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
function f1() {}
public function f2() {}
protected function f3() {}
@ -22,6 +23,7 @@ Comp := Rectangle {
}
export Xxx := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
function foo(a: int) -> string { return a; }
comp := Comp {}
@ -37,7 +39,7 @@ export Xxx := Rectangle {
// ^error{The callback or function expects 1 arguments, but 0 are provided}
root.foo.hello(45);
// ^error{Cannot access fields of a function}
// ^error{Cannot access fields of a function}
comp.f1();
// ^error{The function 'f1' is private. Annotate it with 'public' to make it accessible from other components}
@ -54,7 +56,7 @@ export Xxx := Rectangle {
45()()();
// ^error{The expression is not a function}
(foo)(1);
// ^error{Function must be called. Did you forgot the '\(\)'}
// ^error{Function must be called. Did you forgot the '()'?}
}

View file

@ -90,6 +90,7 @@ export component Bar {
export Foo_Legacy := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
property <int> prop;
callback c1;
pure callback c2;
@ -149,6 +150,7 @@ export Foo_Legacy := Rectangle {
export Bar_Legacy := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
pure callback xc1 <=> f.c1;
// ^error{Purity of callbacks 'xc1' and 'f.c1' doesn't match}
callback xc2 <=> f.c2;

View file

@ -3,10 +3,10 @@
export component App inherits Window{
background: blue;
// ^error{Function must be called}
// ^error{Function must be called. Did you forgot the '()'?}
function blue()->color {
blue
// ^error{Function must be called}
// ^error{Function must be called. Did you forgot the '()'?}
}