Skip to content

Commit 56d9063

Browse files
committed
Update insterface syntax tests
The syntax for declaring an expected diagnostic has changed to include the span (#9703). Update the interface tests that were added using the old syntax.
1 parent 2c740dc commit 56d9063

File tree

7 files changed

+32
-31
lines changed

7 files changed

+32
-31
lines changed

internal/compiler/tests/syntax/interfaces/interface_inheritance.slint

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
33

44
export interface DerivedInterface inherits HelloInterface {
5-
// ^error{Syntax error: expected '{'}
5+
// > <error{Syntax error: expected '{'}
66
}

internal/compiler/tests/syntax/interfaces/interface_invalid_content.slint

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,21 @@
33

44
export interface InvalidInterface {
55
Rectangle {}
6-
// ^error{An interface cannot have sub elements}
6+
// > <error{An interface cannot have sub elements}
77
for x in 2: Text {}
8-
// ^error{An interface cannot have sub elements}
8+
// > <error{An interface cannot have sub elements}
99

1010
out property <int> i;
1111
animate i { duration: 100ms; }
12-
// ^error{An interface cannot have animations}
12+
// > <error{An interface cannot have animations}
1313
states [ ]
14-
// ^error{An interface cannot have states}
14+
// > <error{An interface cannot have states}
1515
transitions [ ]
16-
// ^error{An interface cannot have transitions}
17-
// ^^error{'transitions' block are no longer supported. Use 'in {...}' and 'out {...}' directly in the state definition}
16+
// > <error{An interface cannot have transitions}
17+
// > <^error{'transitions' block are no longer supported. Use 'in {...}' and 'out {...}' directly in the state definition}
1818
callback init;
19-
// ^error{An interface cannot have an 'init' callback}
19+
// > <error{An interface cannot have an 'init' callback}
2020
init => { debug("nope"); }
21-
// ^error{An interface cannot have an 'init' callback}
21+
// >error{An interface cannot have an 'init' callback}
2222
}
23+
//<<<<error{An interface cannot have an 'init' callback}

internal/compiler/tests/syntax/interfaces/interface_properties.slint

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44
export interface ValidInterfacePropertyDeclarations {
55
property <bool> implicit-private;
6-
// ^error{'private' properties are inaccessible in an interface}
6+
// > <error{'private' properties are inaccessible in an interface}
77

88
private property <int> private;
9-
// ^error{'private' properties are inaccessible in an interface}
9+
// > <error{'private' properties are inaccessible in an interface}
1010

1111
in property <int> in-property;
1212
out property <string> out-property;

internal/compiler/tests/syntax/interfaces/interface_uses2.slint

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ interface InterfaceI {
99
component Base implements InterfaceI {}
1010

1111
export component AnotherInvalidUses uses { from Base } {}
12-
// ^error{Expected 'from' keyword in uses specifier}
12+
// > <error{Expected 'from' keyword in uses specifier}

internal/compiler/tests/syntax/interfaces/interfaces.slint

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ interface LineEditInterface {
1212
export component LineEditBase implements LineEditInterface {
1313
text <=> text-input.text;
1414
color <=> text-input.color;
15-
// ^error{Unknown property color}
15+
// > <error{Unknown property color}
1616
text-input := TextInput { }
1717
}
1818

@@ -21,14 +21,14 @@ export component MyLineEdit uses { LineEditInterface from base } {
2121
}
2222

2323
export component Foo implements Bar {}
24-
// ^error{Unknown element 'Bar'}
24+
// > <error{Unknown element 'Bar'}
2525

2626
export component MyRectangle implements Rectangle {}
27-
// ^error{Cannot implement Rectangle. It is not an interface}
27+
// > <error{Cannot implement Rectangle. It is not an interface}
2828

2929
export component LineEdit implements LineEditBase {}
30-
// ^error{Cannot implement LineEditBase. It is not an interface}
30+
// > <error{Cannot implement LineEditBase. It is not an interface}
3131

3232
global MyGlobal {}
3333
export component MyGlobalG implements MyGlobal {}
34-
// ^error{Cannot create an instance of a global component}
34+
// > <error{Cannot create an instance of a global component}

internal/compiler/tests/syntax/interfaces/interfaces_colon_equal.slint

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
33

44
interface UnsupportedInterface := {
5-
// ^error{':=' to declare an interface is not supported. Remove the ':='}
5+
// ><error{':=' to declare an interface is not supported. Remove the ':='}
66
}

internal/compiler/tests/syntax/interfaces/uses_errors.slint

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,42 @@
33

44
export component UsesBuiltin
55
uses { Rectangle from base } {
6-
// ^error{'Rectangle' is not an interface}
6+
// > <error{'Rectangle' is not an interface}
77
base := Rectangle {}
88
}
99

1010
component ComponentA {}
1111

1212
export component UsesComponent
1313
uses { ComponentA from base } {
14-
// ^error{'ComponentA' is not an interface}
14+
// > <error{'ComponentA' is not an interface}
1515
base := ComponentA {}
1616
}
1717

1818
export component UsesMissing
1919
uses { MissingInterface from base } {
20-
// ^error{Unknown element 'MissingInterface'}
20+
// > <error{Unknown element 'MissingInterface'}
2121
base := ComponentA {}
2222
}
2323

2424
export component UsesRow
2525
uses { Row from base } {
26-
// ^error{Row can only be within a GridLayout element}
26+
// > <error{Row can only be within a GridLayout element}
2727
base := ComponentA {}
2828
}
2929

3030
export component UsesRowInGridLayout
3131
uses { Row from base } inherits GridLayout {
32-
// ^error{Row can only be within a GridLayout element}
32+
// > <error{Row can only be within a GridLayout element}
3333
base := ComponentA {}
3434
}
3535

3636
export component MultipleErrors
3737
uses { MissingInterface from base, Rectangle from base, ComponentA from base, Row from base } {
38-
// ^error{Unknown element 'MissingInterface'}
39-
// ^^error{'Rectangle' is not an interface}
40-
// ^^^error{'ComponentA' is not an interface}
41-
// ^^^^error{Row can only be within a GridLayout element}
38+
// > <error{Unknown element 'MissingInterface'}
39+
// > <^error{'Rectangle' is not an interface}
40+
// > <^^error{'ComponentA' is not an interface}
41+
// > <^^^error{Row can only be within a GridLayout element}
4242
base := ComponentA {}
4343
}
4444

@@ -48,11 +48,11 @@ export interface ValidInterface {
4848

4949
export component MissingChild
5050
uses { ValidInterface from base} {}
51-
// ^error{'base' does not exist}
51+
// > <error{'base' does not exist}
5252

5353
export component ChildDoesNotImplementInterface
5454
uses { ValidInterface from base } {
55-
// ^error{base does not implement ValidInterface}
55+
// > <error{base does not implement ValidInterface}
5656
base := ComponentA {}
5757
}
5858

@@ -62,7 +62,7 @@ export component DuplicatePropertyName
6262
uses { ValidInterface from base } {
6363
base := ValidBase {}
6464
in-out property <int> value;
65-
// ^error{Cannot override property 'value' from 'ValidInterface'}
65+
// > <error{Cannot override property 'value' from 'ValidInterface'}
6666
}
6767

6868
component BaseWithProperty {
@@ -71,6 +71,6 @@ component BaseWithProperty {
7171
}
7272

7373
export component DuplicatPropertyOnBase uses { ValidInterface from base } inherits BaseWithProperty {
74-
// ^error{Cannot use interface 'ValidInterface' because property 'value' conflicts with existing property in 'BaseWithProperty'}
74+
// > <error{Cannot use interface 'ValidInterface' because property 'value' conflicts with existing property in 'BaseWithProperty'}
7575
base := ValidBase {}
7676
}

0 commit comments

Comments
 (0)