You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
1.2 KiB
27 lines
1.2 KiB
import {parse} from "./NomScript.peggy";
|
|
import {scriptFile} from "./ScriptFile";
|
|
import {versionStatement} from "./TopLevelStatement";
|
|
|
|
describe("ScriptFile", () => {
|
|
describe("constructor", () => {
|
|
test("puts the statements into the list", () => {
|
|
expect(scriptFile([versionStatement(3)])).toEqual({
|
|
statements: [versionStatement(3)]
|
|
})
|
|
});
|
|
});
|
|
describe("parse", () => {
|
|
test("works with an empty input", () => {
|
|
expect(() => parse("", {grammarSource: "testData", startRule: "ScriptFile"})).not.toThrow()
|
|
});
|
|
test("works with empty lines", () => {
|
|
expect(() => parse("\n\n\n\n\n", {grammarSource: "testData", startRule: "ScriptFile"})).not.toThrow()
|
|
});
|
|
test("works with lines filled only with whitespace", () => {
|
|
expect(() => parse("\n\n \n\t\t \t\n\n", {grammarSource: "testData", startRule: "ScriptFile"})).not.toThrow()
|
|
});
|
|
test("works with lines filled only with comments", () => {
|
|
expect(() => parse("\n\n /* */ \n// test \n /* */\n", {grammarSource: "testData", startRule: "ScriptFile"})).not.toThrow()
|
|
});
|
|
});
|
|
}); |