-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(PreOrderCursorIterator): use generator delegation
Refs #691
- Loading branch information
Showing
3 changed files
with
26 additions
and
34 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
17 changes: 17 additions & 0 deletions
17
packages/apidom-parser-adapter-json/test/syntactic-analysis/PreOrderCursorIterator.ts
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,17 @@ | ||
import { assert } from 'chai'; | ||
|
||
import { lexicalAnalysis } from '../../src/adapter-node'; | ||
import PreOrderCursorIterator from '../../src/syntactic-analysis/PreOrderCusrorIterator'; | ||
|
||
describe('syntactic-analysis', function () { | ||
context('PreOrderCursorIterator', function () { | ||
specify('should create optimized list of surrogate syntax nodes', async function () { | ||
const cst = await lexicalAnalysis('{"a":"b"}'); | ||
const cursor = cst.walk(); | ||
const iterator = new PreOrderCursorIterator(cursor); | ||
const optimizedList = [...iterator]; | ||
|
||
assert.lengthOf(optimizedList, 14); | ||
}); | ||
}); | ||
}); |