Skip to content

Commit

Permalink
test: verify multiple inheritance conflict resolution
Browse files Browse the repository at this point in the history
Outlines solution to #36
  • Loading branch information
nikku committed Dec 17, 2022
1 parent 06d56be commit 8a65475
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/fixtures/model/multiple-inheritance/base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "Multiple Inheritance Base",
"uri": "http://multiple-inheritance-base",
"prefix": "b",
"types": [
{
"name": "Element",
"properties": [
{ "name": "ownedElement", "type": "b:Element", "isMany": true }
]
},
{
"name": "PackageableElement",
"superClass": [ "b:Element" ]
}
]
}
16 changes: 16 additions & 0 deletions test/fixtures/model/multiple-inheritance/glue.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "Multiple Inheritance Glue",
"uri": "http://multiple-inheritance-glue",
"prefix": "g",
"types": [
{
"name": "Diagram",
"superClass": [
"b:PackageableElement"
],
"extends": [
"o:Diagram"
]
}
]
}
19 changes: 19 additions & 0 deletions test/fixtures/model/multiple-inheritance/other.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "Multiple Inheritance Other",
"uri": "http://multiple-inheritance-other",
"prefix": "o",
"types": [
{
"name": "DiagramElement",
"properties": [
{ "name": "ownedElement", "type": "DiagramElement", "isMany": true }
]
},
{
"name": "Diagram",
"superClass": [
"DiagramElement"
]
}
]
}
28 changes: 28 additions & 0 deletions test/spec/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,34 @@ describe('extension', function() {

});


describe('name clashes', function() {

var model = createModel([
'multiple-inheritance/base',
'multiple-inheritance/other',
'multiple-inheritance/glue'
]);


it('should handle multiple inheritance through virtual package', function() {

var baseElement = model.create('b:Element');

var otherElement = model.create('o:DiagramElement');

var diagram = model.create('o:Diagram', {
'b:ownedElement': [ baseElement ],
ownedElement: [ otherElement ]
});

// then
expect(diagram.$instanceOf('b:Element')).to.be.true;
expect(diagram.$instanceOf('o:DiagramElement')).to.be.true;
});

});

});


Expand Down

0 comments on commit 8a65475

Please sign in to comment.