From 4296b3f44e1a81649d65cee6b51832ea192a822c Mon Sep 17 00:00:00 2001 From: "jonathan.casey" Date: Thu, 27 Apr 2023 11:40:54 +0100 Subject: [PATCH] test(*): negative case for map type - too many properties --- packages/concerto-cto/test/cto/bad/map.bad.cto | 11 +++++++++++ packages/concerto-cto/test/parserMain.js | 9 +++++++++ 2 files changed, 20 insertions(+) create mode 100644 packages/concerto-cto/test/cto/bad/map.bad.cto diff --git a/packages/concerto-cto/test/cto/bad/map.bad.cto b/packages/concerto-cto/test/cto/bad/map.bad.cto new file mode 100644 index 0000000000..8d4c164bbb --- /dev/null +++ b/packages/concerto-cto/test/cto/bad/map.bad.cto @@ -0,0 +1,11 @@ +namespace com.acme@1.0.0 + +map Library { + o String + o String + o Dictionary +} + +concept Concept { + o Library library +} diff --git a/packages/concerto-cto/test/parserMain.js b/packages/concerto-cto/test/parserMain.js index a0b0c58a28..b7c29560cb 100644 --- a/packages/concerto-cto/test/parserMain.js +++ b/packages/concerto-cto/test/parserMain.js @@ -65,6 +65,15 @@ describe('parser', () => { ); }); + describe('maps', () => { + it('Should not parse bad map type', () => { + let content = fs.readFileSync('./test/cto/bad/map.bad.cto', 'utf8'); + (() => { + Parser.parse(content); + }).should.throw(/Expected .+ but /); + }); + }); + describe('identifiers', () => { const acceptedIdentifiers = [