-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: split combination and scenario tests
- Loading branch information
1 parent
07ea84b
commit a8adb33
Showing
5 changed files
with
68 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import test from "ava"; | ||
import FenceParser from "../src/index.js"; | ||
import fixtures from "./fixtures/combinations.js"; | ||
import macro from "./macro.js"; | ||
|
||
const parser = new FenceParser(); | ||
|
||
for (const fixture of fixtures) { | ||
const result = parser.parse(fixture.input); | ||
const expected = fixture.output; | ||
const title = `input "${fixture.input}"`; | ||
|
||
test(title, macro, result, expected); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const fixtures = [ | ||
{ | ||
input: '', | ||
output: {}, | ||
}, | ||
{ | ||
input: '{}', | ||
output: {}, | ||
}, | ||
{ | ||
input: 'true="false"', | ||
output: { | ||
true: "false", | ||
}, | ||
}, | ||
{ | ||
input: 'maxRun="1"', | ||
output: { | ||
maxRun: "1", | ||
}, | ||
}, | ||
{ | ||
input: '{1}', | ||
output: { mark: [1] }, | ||
options: { rangeKey: "mark" }, | ||
}, | ||
{ | ||
input: '{11..8, 20}', | ||
output: { highlight: [8, 9, 10, 11, 20] }, | ||
} | ||
]; | ||
|
||
export default fixtures; |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import test from "ava"; | ||
import FenceParser from "../src/index.js"; | ||
import fixtures from "./fixtures/scenarios.js"; | ||
import macro from "./macro.js"; | ||
|
||
const parser = new FenceParser(); | ||
|
||
for (const fixture of fixtures) { | ||
let result; | ||
if (fixture.options) { | ||
result = (new FenceParser(fixture.options)).parse(fixture.input); | ||
} else { | ||
result = parser.parse(fixture.input); | ||
} | ||
|
||
const expected = fixture.output; | ||
const title = `input "${fixture.input}"`; | ||
|
||
test(title, macro, result, expected); | ||
} |