Files
test-repo/tests/es_declare_module/es_declare_module.js
T
Christopher Chedeau cf45afba61 Add testing
- 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.
2016-12-23 19:51:53 +00:00

42 lines
1.1 KiB
JavaScript

// @flow
import {num1, str1} from "CJS_Named";
import CJS_Named from "CJS_Named";
(num1: number);
(num1: string); // Error: number ~> string
(str1: string);
(str1: number); // Error: string ~> number
(CJS_Named: {num1: number, str1: string});
(CJS_Named: number); // Error: Module ~> number
import {num2} from "CJS_Clobbered"; // Error: No such export!
import {numExport} from "CJS_Clobbered";
(numExport: number);
(numExport: string); // Error: number ~> string
import type {numType} from "CJS_Clobbered";
(42: numType);
('asdf': numType); // Error: string ~> number
import {strHidden} from "ES"; // Error: No such export!
import {str3} from "ES";
(str3: string);
(str3: number); // Error: string ~> number
import {num3} from "ES";
(num3: number);
(num3: string); // Error: number ~> string
import {C} from "ES";
import type {C as CType} from "ES";
(new C(): C);
(42: C); // Error: number ~> C
(new C(): CType);
(42: CType); // Error: number ~> CType
import {T} from "ES"; // Error: T is a type import, not a value
import type {T as T2} from "ES";
(42: T2);
('asdf': T2); // Error: string ~> number
import {exports as nope} from "ES"; // Error: Not an export