mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-09 02:27:05 +02:00
#1206 Added test case to verify parsing fails to allow EOF until first '{' is closed
This commit is contained in:
@@ -67,7 +67,7 @@ describe('class diagram, ', function () {
|
|||||||
parser.parse(str);
|
parser.parse(str);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should break when double { are encountered while defining generic class with brackets', function() {
|
it('should break when another `{`is encountered before closing the first one while defining generic class with brackets', function() {
|
||||||
const str =
|
const str =
|
||||||
'classDiagram\n' +
|
'classDiagram\n' +
|
||||||
'class Dummy_Class~T~ {\n' +
|
'class Dummy_Class~T~ {\n' +
|
||||||
@@ -90,6 +90,25 @@ describe('class diagram, ', function () {
|
|||||||
expect(testPased).toBe(true);
|
expect(testPased).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should break when EOF is encountered before closing the first `{` while defining generic class with brackets', function() {
|
||||||
|
const str =
|
||||||
|
'classDiagram\n' +
|
||||||
|
'class Dummy_Class~T~ {\n' +
|
||||||
|
'String data\n' +
|
||||||
|
' void methods()\n' +
|
||||||
|
'}\n' +
|
||||||
|
'\n' +
|
||||||
|
'class Dummy_Class {\n';
|
||||||
|
let testPased =false;
|
||||||
|
try{
|
||||||
|
parser.parse(str);
|
||||||
|
}catch (error){
|
||||||
|
console.log(error.name);
|
||||||
|
testPased = true;
|
||||||
|
}
|
||||||
|
expect(testPased).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
it('should handle generic class with brackets', function() {
|
it('should handle generic class with brackets', function() {
|
||||||
const str =
|
const str =
|
||||||
'classDiagram\n' +
|
'classDiagram\n' +
|
||||||
|
Reference in New Issue
Block a user