Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0df5a49
commit e9ad144
Showing
8 changed files
with
146 additions
and
50 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,30 @@ | ||
const parser = require('../main'); | ||
const parser = require("../main"); | ||
|
||
describe('break', () => { | ||
it('simple', () => { | ||
expect(parser.parseEval('break;')).toMatchSnapshot(); | ||
describe("break", () => { | ||
it("simple", () => { | ||
expect(parser.parseEval("break;")).toMatchSnapshot(); | ||
}); | ||
it('argument 0', () => { | ||
expect(parser.parseEval('break 0;')).toMatchSnapshot(); | ||
it("argument 0", () => { | ||
expect(parser.parseEval("break 0;")).toMatchSnapshot(); | ||
}); | ||
it('argument 1', () => { | ||
expect(parser.parseEval('break 1;')).toMatchSnapshot(); | ||
it("argument 1", () => { | ||
expect(parser.parseEval("break 1;")).toMatchSnapshot(); | ||
}); | ||
it('argument 2', () => { | ||
expect(parser.parseEval('break 2;')).toMatchSnapshot(); | ||
it("argument 2", () => { | ||
expect(parser.parseEval("break 2;")).toMatchSnapshot(); | ||
}); | ||
it('with parens', () => { | ||
expect(parser.parseEval('break (1);')).toMatchSnapshot(); | ||
it("with parens", () => { | ||
expect(parser.parseEval("break (1);")).toMatchSnapshot(); | ||
}); | ||
// Deprecated since 5.4.0 | ||
it('with expression', () => { | ||
expect(parser.parseEval('break $var;')).toMatchSnapshot(); | ||
it("with expression", () => { | ||
expect(parser.parseEval("break $var;")).toMatchSnapshot(); | ||
}); | ||
it("should fail when no ';' at end", function() { | ||
expect( | ||
parser.parseEval("break", { | ||
parser: { suppressErrors: true } | ||
}) | ||
).toMatchSnapshot(); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1,23 +1,30 @@ | ||
const parser = require('../main'); | ||
const parser = require("../main"); | ||
|
||
describe('continue', () => { | ||
it('simple', () => { | ||
expect(parser.parseEval('continue;')).toMatchSnapshot(); | ||
describe("continue", () => { | ||
it("simple", () => { | ||
expect(parser.parseEval("continue;")).toMatchSnapshot(); | ||
}); | ||
it('argument 0', () => { | ||
expect(parser.parseEval('continue 0;')).toMatchSnapshot(); | ||
it("argument 0", () => { | ||
expect(parser.parseEval("continue 0;")).toMatchSnapshot(); | ||
}); | ||
it('argument 1', () => { | ||
expect(parser.parseEval('continue 1;')).toMatchSnapshot(); | ||
it("argument 1", () => { | ||
expect(parser.parseEval("continue 1;")).toMatchSnapshot(); | ||
}); | ||
it('argument 2', () => { | ||
expect(parser.parseEval('continue 2;')).toMatchSnapshot(); | ||
it("argument 2", () => { | ||
expect(parser.parseEval("continue 2;")).toMatchSnapshot(); | ||
}); | ||
it('with parens', () => { | ||
expect(parser.parseEval('continue (1);')).toMatchSnapshot(); | ||
it("with parens", () => { | ||
expect(parser.parseEval("continue (1);")).toMatchSnapshot(); | ||
}); | ||
// Deprecated since 5.4.0 | ||
it('with expression', () => { | ||
expect(parser.parseEval('continue $var;')).toMatchSnapshot(); | ||
it("with expression", () => { | ||
expect(parser.parseEval("continue $var;")).toMatchSnapshot(); | ||
}); | ||
it("should fail when no ';' at end", function() { | ||
expect( | ||
parser.parseEval("continue", { | ||
parser: { suppressErrors: true } | ||
}) | ||
).toMatchSnapshot(); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1,10 +1,17 @@ | ||
const parser = require('../main'); | ||
const parser = require("../main"); | ||
|
||
describe("return", function() { | ||
it("simple", function() { | ||
expect(parser.parseEval('return "string";')).toMatchSnapshot(); | ||
}); | ||
it("no expression", function() { | ||
expect(parser.parseEval('return;')).toMatchSnapshot(); | ||
expect(parser.parseEval("return;")).toMatchSnapshot(); | ||
}); | ||
it("should fail when no ';' at end", function() { | ||
expect( | ||
parser.parseEval("return", { | ||
parser: { suppressErrors: true } | ||
}) | ||
).toMatchSnapshot(); | ||
}); | ||
}); |