Skip to content

Commit e9bcf65

Browse files
committed
ST6RI-830 Added xpect tests for global qualification
1 parent 7876769 commit e9bcf65

4 files changed

Lines changed: 155 additions & 0 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//*
2+
XPECT_SETUP org.omg.kerml.xpect.tests.linking.KerMLLinkingTest
3+
ResourceSet {
4+
ThisFile {}
5+
File {from ="/library/Base.kerml"}
6+
File {from ="/library/Occurrences.kerml"}
7+
File {from ="/library/Objects.kerml"}
8+
}
9+
Workspace {
10+
JavaProject {
11+
SrcFolder {
12+
ThisFile {}
13+
File {from ="/library/Base.kerml"}
14+
File {from ="/library/Occurrences.kerml"}
15+
File {from ="/library/Objects.kerml"}
16+
}
17+
}
18+
}
19+
END_SETUP
20+
*/
21+
package Classes2 {
22+
class A;
23+
}
24+
25+
package Classes1 {
26+
// XPECT linkedName at A --> Classes2.A
27+
private class B specializes $::Classes2::A {
28+
// XPECT linkedName at A --> Classes1.Classes2.A
29+
private y: Classes2::A;
30+
}
31+
32+
package Classes2 {
33+
class A;
34+
}
35+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//*
2+
XPECT_SETUP org.omg.kerml.xpect.tests.linking.KerMLLinkingTest
3+
ResourceSet {
4+
ThisFile {}
5+
File {from ="/library/Base.kerml"}
6+
File {from ="/library/Occurrences.kerml"}
7+
File {from ="/library/Objects.kerml"}
8+
File "Classes2.kerml" {}
9+
}
10+
Workspace {
11+
JavaProject {
12+
SrcFolder {
13+
ThisFile {}
14+
File {from ="/library/Base.kerml"}
15+
File {from ="/library/Occurrences.kerml"}
16+
File {from ="/library/Objects.kerml"}
17+
File "Classes2.kerml" {}
18+
}
19+
}
20+
}
21+
END_SETUP
22+
*/
23+
24+
package Classes1 {
25+
private import Classes2::*;
26+
27+
package Classes2;
28+
class A;
29+
30+
// XPECT linkedName at A --> Classes2.A
31+
private class B specializes $::Classes2::A {
32+
// XPECT linkedName at A --> Classes1.A
33+
private y: A;
34+
}
35+
36+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
//*
2+
XPECT_SETUP org.omg.sysml.xpect.tests.validation.valid.SysMLTests
3+
ResourceSet {
4+
ThisFile {}
5+
File {from ="/library.kernel/Base.kerml"}
6+
File {from ="/library.kernel/Occurrences.kerml"}
7+
File {from ="/library.kernel/Objects.kerml"}
8+
File {from ="/library.kernel/Performances.kerml"}
9+
File {from ="/library.kernel/BaseFunctions.kerml"}
10+
File {from ="/library.kernel/ScalarValues.kerml"}
11+
File {from ="/library.systems/Items.sysml"}
12+
File {from ="/library.systems/Parts.sysml"}
13+
File {from ="/library.systems/Ports.sysml"}
14+
File {from ="/library.systems/Attributes.sysml"}
15+
}
16+
Workspace {
17+
JavaProject {
18+
SrcFolder {
19+
ThisFile {}
20+
File {from ="/library.kernel/Base.kerml"}
21+
File {from ="/library.kernel/Occurrences.kerml"}
22+
File {from ="/library.kernel/Objects.kerml"}
23+
File {from ="/library.kernel/Performances.kerml"}
24+
File {from ="/library.kernel/BaseFunctions.kerml"}
25+
File {from ="/library.kernel/ScalarValues.kerml"}
26+
File {from ="/library.systems/Items.sysml"}
27+
File {from ="/library.systems/Parts.sysml"}
28+
File {from ="/library.systems/Ports.sysml"}
29+
File {from ="/library.systems/Attributes.sysml"}
30+
}
31+
}
32+
}
33+
END_SETUP
34+
*/
35+
36+
package Definitions {
37+
part def A;
38+
}
39+
40+
package Parts {
41+
package Definitions {
42+
part def A;
43+
}
44+
// XPECT linkedName at A --> Parts.Definitions.A
45+
part a1: Definitions::A;
46+
// XPECT linkedName at A --> Definitions.A
47+
part a2: $::Definitions::A;
48+
// XPECT errors --> "Couldn't resolve reference to Feature 'Parts::parts'." at "Parts::parts"
49+
part a3 :> Parts::parts;
50+
// XPECT linkedName at parts --> Parts.parts
51+
part a4 :> $::Parts::parts;
52+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* SysML 2 Pilot Implementation
3+
* Copyright (C) 2025 Model Driven Solutions, Inc.
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU Lesser General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU Lesser General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Lesser General Public License
16+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*
18+
* @license LGPL-3.0-or-later <http://spdx.org/licenses/LGPL-3.0-or-later>
19+
*
20+
* Contributors:
21+
* Laszlo Gati, MDS
22+
*/
23+
package org.omg.sysml.xpect.tests.linking;
24+
25+
import org.eclipse.xpect.runner.XpectRunner;
26+
import org.junit.runner.RunWith;
27+
import org.omg.kerml.xpect.KerMLXtextTests;
28+
29+
@RunWith(XpectRunner.class)
30+
public class LinkingTests extends KerMLXtextTests {
31+
32+
}

0 commit comments

Comments
 (0)