-
-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(vocabulary): vocaulary for map types (#755)
* feat(vocabulary): vocaulary for map types Signed-off-by: Sanket Shevkar <[email protected]> * feat(vocabulary): enable map types for tests Signed-off-by: Sanket Shevkar <[email protected]> * feat(vocabulary): resolved review comments Signed-off-by: Sanket Shevkar <[email protected]> * feat(vocabulary): addressed comments Signed-off-by: Sanket Shevkar <[email protected]> * feat(vocabulary): addressed comments Signed-off-by: Sanket Shevkar <[email protected]> * feat(vocabulary): addressed comments Signed-off-by: Sanket Shevkar <[email protected]> --------- Signed-off-by: Sanket Shevkar <[email protected]> Signed-off-by: Sanket Shevkar <[email protected]> Co-authored-by: Sanket Shevkar <[email protected]>
- Loading branch information
1 parent
4758d64
commit 53abb6d
Showing
18 changed files
with
269 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,20 @@ | |
"name" : "web", | ||
"version": "1.0.0", | ||
"commands" : [ | ||
{ | ||
"$class" : "[email protected]", | ||
"type" : "UPSERT", | ||
"target" : { | ||
"$class" : "[email protected]", | ||
"namespace" : "[email protected]", | ||
"declaration" : "Dictionary" | ||
}, | ||
"decorator" : { | ||
"$class" : "[email protected]", | ||
"name" : "MapDeclarationDecorator", | ||
"arguments" : [] | ||
} | ||
}, | ||
{ | ||
"$class" : "[email protected]", | ||
"type" : "APPEND", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -188,6 +188,21 @@ describe('DecoratorManager', () => { | |
decoratorCity2Property.should.not.be.null; | ||
}); | ||
|
||
it('should decorate the specified MapDeclaration', async function() { | ||
// load a model to decorate | ||
const testModelManager = new ModelManager({strict:true, skipLocationNodes: true}); | ||
const modelText = fs.readFileSync('./test/data/decoratorcommands/test.cto', 'utf-8'); | ||
testModelManager.addCTOModel(modelText, 'test.cto'); | ||
|
||
const dcs = fs.readFileSync('./test/data/decoratorcommands/map-declaration.json', 'utf-8'); | ||
const decoratedModelManager = DecoratorManager.decorateModels( testModelManager, JSON.parse(dcs), | ||
{validate: true, validateCommands: true}); | ||
|
||
const dictionary = decoratedModelManager.getType('[email protected]'); | ||
dictionary.should.not.be.null; | ||
dictionary.getDecorator('MapDeclarationDecorator').should.not.be.null; | ||
}); | ||
|
||
it('should decorate the specified element on the specified Map Declaration (Map Key)', async function() { | ||
// load a model to decorate | ||
const testModelManager = new ModelManager({strict:true, skipLocationNodes: true}); | ||
|
@@ -284,7 +299,7 @@ describe('DecoratorManager', () => { | |
dictionary.value.getDecorator('DecoratesValueByType').should.not.be.null; | ||
}); | ||
|
||
it('should decorate both Key and Value elements on the specified Map Declaration', async function() { | ||
it('should decorate Declaration, Key and Value elements on the specified Map Declaration', async function() { | ||
// load a model to decorate | ||
const testModelManager = new ModelManager({strict:true, skipLocationNodes: true}); | ||
const modelText = fs.readFileSync('./test/data/decoratorcommands/test.cto', 'utf-8'); | ||
|
@@ -297,6 +312,7 @@ describe('DecoratorManager', () => { | |
const dictionary = decoratedModelManager.getType('[email protected]'); | ||
|
||
dictionary.should.not.be.null; | ||
dictionary.getDecorator('MapDeclarationDecorator').should.not.be.null; | ||
dictionary.key.getDecorator('Baz').should.not.be.null; | ||
dictionary.value.getDecorator('Baz').should.not.be.null; | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -757,4 +757,12 @@ describe('MapDeclaration', () => { | |
declaration.getValue().getParent().should.equal(declaration); | ||
}); | ||
}); | ||
|
||
describe('#getNamespace', () => { | ||
it('should return the correct namespace for a Map Declaration Key and Value', () => { | ||
let declaration = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.goodkey.primitive.string.cto', MapDeclaration); | ||
declaration.getKey().getNamespace().should.equal('[email protected]'); | ||
declaration.getValue().getNamespace().should.equal('[email protected]'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.