-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3077 from antlr/fix-javascript-intervalset
Fix javascript intervalset, fix #3075
- Loading branch information
Showing
6 changed files
with
6,046 additions
and
15 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
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,29 @@ | ||
import antlr4 from "../antlr4/index.js"; | ||
|
||
it("merges interval sets properly", () => { | ||
|
||
const s1 = new antlr4.IntervalSet(); | ||
s1.addOne(10); | ||
expect(s1.toString()).toEqual("10"); | ||
const s2 = new antlr4.IntervalSet(); | ||
s2.addOne(12); | ||
expect(s2.toString()).toEqual("12"); | ||
const merged = new antlr4.IntervalSet(); | ||
merged.addSet(s1); | ||
expect(merged.toString()).toEqual("10"); | ||
merged.addSet(s2); | ||
expect(merged.toString()).toEqual("{10, 12}"); | ||
let s3 = new antlr4.IntervalSet(); | ||
s3.addOne(10); | ||
merged.addSet(s3); | ||
expect(merged.toString()).toEqual("{10, 12}"); | ||
s3 = new antlr4.IntervalSet(); | ||
s3.addOne(11); | ||
merged.addSet(s3); | ||
expect(merged.toString()).toEqual("10..12"); | ||
s3 = new antlr4.IntervalSet(); | ||
s3.addOne(12); | ||
merged.addSet(s3); | ||
expect(merged.toString()).toEqual("10..12"); | ||
|
||
}); |
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 |
---|---|---|
|
@@ -25,4 +25,4 @@ module.exports = { | |
} | ||
}] | ||
} | ||
} | ||
}; |
Oops, something went wrong.