- This brings in the flow test suite that contains a ton of JavaScript parsing edge cases - This creates snapshot tests using the pretty printer for all of them - If uncomment `RUN_AST_TESTS` line in `tests/run_specs.js`, it checks ast(pretty_print(x)) == ast(x). Right now, "178 failed, 197 passed, 375 of 377 total". So half of the tests are not passing, most of them are crashes and many of the rest are subtle issues.
24 lines
851 B
JavaScript
24 lines
851 B
JavaScript
// @flow
|
|
|
|
let data = require('./package/index.json');
|
|
(data.foo: void); // error, should be object literal
|
|
(data.foo.bar: void); // error, should be boolean
|
|
(data.abc: boolean); // error, should be ?string
|
|
|
|
let data2 = require('./package');
|
|
(data2.baz: void); // error, should be string
|
|
|
|
let data3 = require('./package2');
|
|
(data3.foo: void); // error, should be number (not string! index.js wins)
|
|
|
|
let data4 = require('./json_array');
|
|
(data4: Array<number>);
|
|
(data4: void); // error, should be Array<number>
|
|
|
|
(require('./json_string'): void); // error, should be string
|
|
(require('./json_number'): void); // error, should be number
|
|
(require('./json_true'): void); // error, should be true
|
|
(require('./json_false'): void); // error, should be false
|
|
(require('./json_null'): void); // error, should be null
|
|
(require('./json_negative_number'): -1); // ok
|