Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kyklish committed May 24, 2024
1 parent f91eaa7 commit 972586c
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/parser/parser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,39 @@ suite('Parser', () => {
});
});

suite('getLabelByLine', () => {
// List of test data
const dataList = [
// {
// in: // input test string
// rs: // expected result - label name or undefined
// },
{
in: 'ValidLabel:',
rs: 'ValidLabel',
},
{
in: 'NotValidLabel :',
rs: undefined,
},
];
dataList.forEach((data) => {
test("'" + data.in + "' => '" + data.rs + "'", async () => {
const document = await vscode.workspace.openTextDocument({
language: 'ahk',
content: data.in,
});
// Use array access for the private members
const label = Parser['getLabelByLine'](document, 0);
if (label === undefined) {
assert.equal(label, data.rs);
} else {
assert.strictEqual(label.name, data.rs);
}
});
});
});

suite('getRemarkByLine', () => {
// List of test data
const dataList = [
Expand Down

0 comments on commit 972586c

Please sign in to comment.