Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
alessiostalla committed Sep 4, 2023
1 parent c38177a commit 57bc66f
Show file tree
Hide file tree
Showing 2 changed files with 233 additions and 7 deletions.
228 changes: 228 additions & 0 deletions tests/data/playground/metamodel.json
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,234 @@
}
]
},
{
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EClass",
"name": "NodeWithError",
"abstract": false,
"interface": false,
"eSuperTypes": [
{
"$ref": "/0/SomeNodeInPackage",
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EClass"
}
],
"eStructuralFeatures": [
{
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EReference",
"name": "errorNode",
"eType": {
"$ref": "https://strumenta.com/starlasu/v2#//ASTNode",
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EClass"
},
"ordered": true,
"unique": true,
"lowerBound": 0,
"upperBound": 1,
"containment": true
}
]
},
{
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EClass",
"name": "SomeNodeInPackage",
"abstract": false,
"interface": false,
"eSuperTypes": [
{
"$ref": "https://strumenta.com/starlasu/v2#//ASTNode",
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EClass"
}
],
"eStructuralFeatures": [
{
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EAttribute",
"name": "a",
"eType": {
"$ref": "http://www.eclipse.org/emf/2002/Ecore#//EString",
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EDataType"
},
"ordered": true,
"unique": true,
"lowerBound": 0,
"upperBound": 1
},
{
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EReference",
"name": "someNode",
"eType": {
"$ref": "https://strumenta.com/starlasu/v2#//ASTNode",
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EClass"
},
"ordered": true,
"unique": true,
"lowerBound": 0,
"upperBound": 1,
"containment": true
},
{
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EReference",
"name": "multi",
"eType": {
"$ref": "https://strumenta.com/starlasu/v2#//ASTNode",
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EClass"
},
"ordered": true,
"unique": true,
"lowerBound": 0,
"upperBound": -1,
"containment": true
}
]
},
{
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EClass",
"name": "NodeSubclass",
"abstract": false,
"interface": false,
"eSuperTypes": [
{
"$ref": "/0/SomeNodeInPackage",
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EClass"
}
],
"eStructuralFeatures": [
{
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EAttribute",
"name": "b",
"ordered": true,
"unique": true,
"lowerBound": 0,
"upperBound": 1
},
{
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EReference",
"name": "anotherChild",
"eType": {
"$ref": "https://strumenta.com/starlasu/v2#//ASTNode",
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EClass"
},
"ordered": true,
"unique": true,
"lowerBound": 0,
"upperBound": 1,
"containment": true
}
]
},
{
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EClass",
"name": "NodeWithError",
"abstract": false,
"interface": false,
"eSuperTypes": [
{
"$ref": "/0/SomeNodeInPackage",
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EClass"
}
],
"eStructuralFeatures": [
{
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EReference",
"name": "errorNode",
"eType": {
"$ref": "https://strumenta.com/starlasu/v2#//ASTNode",
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EClass"
},
"ordered": true,
"unique": true,
"lowerBound": 0,
"upperBound": 1,
"containment": true
}
]
},
{
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EClass",
"name": "SomeNodeInPackage",
"abstract": false,
"interface": false,
"eSuperTypes": [
{
"$ref": "https://strumenta.com/starlasu/v2#//ASTNode",
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EClass"
}
],
"eStructuralFeatures": [
{
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EAttribute",
"name": "a",
"eType": {
"$ref": "http://www.eclipse.org/emf/2002/Ecore#//EString",
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EDataType"
},
"ordered": true,
"unique": true,
"lowerBound": 0,
"upperBound": 1
},
{
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EReference",
"name": "someNode",
"eType": {
"$ref": "https://strumenta.com/starlasu/v2#//ASTNode",
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EClass"
},
"ordered": true,
"unique": true,
"lowerBound": 0,
"upperBound": 1,
"containment": true
},
{
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EReference",
"name": "multi",
"eType": {
"$ref": "https://strumenta.com/starlasu/v2#//ASTNode",
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EClass"
},
"ordered": true,
"unique": true,
"lowerBound": 0,
"upperBound": -1,
"containment": true
}
]
},
{
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EClass",
"name": "NodeSubclass",
"abstract": false,
"interface": false,
"eSuperTypes": [
{
"$ref": "/0/SomeNodeInPackage",
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EClass"
}
],
"eStructuralFeatures": [
{
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EAttribute",
"name": "b",
"ordered": true,
"unique": true,
"lowerBound": 0,
"upperBound": 1
},
{
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EReference",
"name": "anotherChild",
"eType": {
"$ref": "https://strumenta.com/starlasu/v2#//ASTNode",
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EClass"
},
"ordered": true,
"unique": true,
"lowerBound": 0,
"upperBound": 1,
"containment": true
}
]
},
{
"eClass": "http://www.eclipse.org/emf/2002/Ecore#//EClass",
"name": "NodeWithError",
Expand Down
12 changes: 5 additions & 7 deletions tests/transformation/transformation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ import {
ASTNode,
ASTTransformer,
Child,
ErrorNode,
ErrorNode, GenericErrorNode,
Init,
IssueSeverity,
Mapped,
Node, NodeFactory,
NodeTransform,
PartiallyInitializedNode, pos, Position,
Property,
Node, NodeTransform,
PartiallyInitializedNode, pos, Property,
transform
} from "../../src";
import exp = require("constants");
Expand Down Expand Up @@ -88,8 +86,8 @@ describe('AST transformations', function() {
expect(nodeB.method).to.equal("method");
expect(nodeB.nested).to.equal("innerValue");
expect(nodeB.aChild instanceof B).to.be.true;
expect(nodeB.error instanceof ErrorNode).to.be.true;
expect(nodeB.error.error.message).to.equal("I don't like this");
expect(nodeB.error instanceof GenericErrorNode).to.be.true;
expect(nodeB.error.message).to.equal("Exception Error: I don't like this");
expect(nodeB.source).to.equal(nodeA);
});
it("handles exceptions on init",
Expand Down

0 comments on commit 57bc66f

Please sign in to comment.