-
Notifications
You must be signed in to change notification settings - Fork 87
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 #193 from SebastienGllmt/bigint-test
Add test for bigint support
- Loading branch information
Showing
7 changed files
with
50 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`should handle bigint literals in type 1`] = ` | ||
"declare type MyBigType = bigint; | ||
declare type bigint_like = number | bigint | string; | ||
declare var literal: 9007199254740991n; | ||
" | ||
`; |
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,31 @@ | ||
import { compiler, beautify } from ".."; | ||
import "../test-matchers"; | ||
|
||
it("should handle bigint literals in type", () => { | ||
const ts = ` | ||
type MyBigType = bigint; | ||
type bigint_like = number | bigint | string; | ||
const literal = 9007199254740991n; | ||
`; | ||
|
||
// unsupported expressions that should be supported | ||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt | ||
// const ts = ` | ||
// const ctor = BigInt("9007199254740991"); | ||
// const add = 4n + 5n; | ||
// const mult = 4n * 5n; | ||
// const sub = 4n - 5n; | ||
// const mod = 4n % 3n; | ||
// const exp = 4n ** 2n; | ||
// const div = 4n / 2n; | ||
// const eq = 4n == 0; | ||
// const cmp = 4n > 0; | ||
// const mixed = [4n, 6, -12n, 10, 4, 0, 0n]; | ||
// const boolCast = !12n; | ||
// `; | ||
|
||
const result = compiler.compileDefinitionString(ts, { quiet: true }); | ||
|
||
expect(beautify(result)).toMatchSnapshot(); | ||
expect(result).toBeValidFlowTypeDeclarations(); | ||
}); |
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