- 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.
26 lines
606 B
JavaScript
26 lines
606 B
JavaScript
/* @flow */
|
|
|
|
declare function map<Tv, TNext>(
|
|
obj: {[key: string]: Tv},
|
|
iterator:((obj: Tv) => TNext),
|
|
): Array<TNext>;
|
|
|
|
/**
|
|
* Tests overriding a property via a spread, where the value is a tvar. the
|
|
* type of the prop from the object that is being overridden (`x.kind` in the
|
|
* case below) should //not// feed back into the tvar (`value`), since the
|
|
* result is a new object.
|
|
*/
|
|
function test(
|
|
x: {kind: ?string},
|
|
kinds: {[key: string]: string}
|
|
): Array<{kind: ?string}> {
|
|
return map(kinds, (value) => {
|
|
(value: string); // OK
|
|
return {
|
|
...x,
|
|
kind: value,
|
|
};
|
|
});
|
|
}
|