Skip to content

Commit

Permalink
Add test for incremental parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
PaddiM8 committed May 23, 2024
1 parent bffc7f4 commit 14695bd
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions server/src/project/test/document.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,27 @@ describe('ModelicaDocument', () => {
assert.equal(document.getText().trim(), UPDATED_TEST_PACKAGE_CONTENT.trim());
});

it('can update incrementally', () => {
const textDocument = createTextDocument('.', TEST_PACKAGE_CONTENT);
const tree = project.parser.parse(TEST_PACKAGE_CONTENT);
const document = new ModelicaDocument(library, textDocument, tree);
document.update(
'1.0.1',
{
start: {
line: 1,
character: 22,
},
end: {
line: 1,
character: 27,
},
}
);

assert.equal(document.getText().trim(), UPDATED_TEST_PACKAGE_CONTENT.trim());
});

it('a file with no `within` clause has the correct package path', () => {
const textDocument = createTextDocument('./package.mo', TEST_PACKAGE_CONTENT);
const tree = project.parser.parse(TEST_PACKAGE_CONTENT);
Expand Down

0 comments on commit 14695bd

Please sign in to comment.