prettier/tests/recheck/__snapshots__/jsfmt.spec.js.snap

314 lines
5.6 KiB
Plaintext
Raw Normal View History

exports[`test a1.js 1`] = `
"// @flow
function foo(x: number): string { return 5; }
foo(0);
module.exports = foo;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow
function foo(x: number): string {
2016-12-27 21:29:31 +03:00
return [object Number];
}
2016-12-27 21:29:31 +03:00
foo([object Number]);
module.exports = foo;
"
`;
exports[`test a2.js 1`] = `
"// @flow
2016-12-27 21:29:31 +03:00
const foo = require('./a1');
2016-12-27 21:29:31 +03:00
module.exports = foo("");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow
2016-12-27 21:29:31 +03:00
const foo = require("./a1");
module.exports = foo("");
"
`;
exports[`test a3.js 1`] = `
"// @flow
2016-12-27 21:29:31 +03:00
const five = require('./a2');
(five + five: string);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow
2016-12-27 21:29:31 +03:00
const five = require("./a2");
(five + five: string);
"
`;
exports[`test b0.js 1`] = `
"// @flow
class C { x: C; }
class E { x: C; }
module.exports = { C, E };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow
class C {
x: C;
}
class E {
x: C;
}
module.exports = { C, E };
"
`;
exports[`test b1.js 1`] = `
"// @flow
2016-12-27 21:29:31 +03:00
import { C, E } from "./b0";
function foo() { return C; }
function bar() { return E; }
let X = foo();
class F extends X { }
class D extends F { }
module.exports = { C, D };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow
2016-12-27 21:29:31 +03:00
import { C, E } from "./b0";
function foo() {
return C;
}
function bar() {
return E;
}
let X = foo();
class F extends X {}
class D extends F {}
module.exports = { C, D };
"
`;
exports[`test b2.js 1`] = `
"// @flow
2016-12-27 21:29:31 +03:00
module.exports = require("./b1");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow
2016-12-27 21:29:31 +03:00
module.exports = require("./b1");
"
`;
exports[`test b3.js 1`] = `
"// @flow
2016-12-27 21:29:31 +03:00
import { C, D } from "./b2";
(new D: C);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow
2016-12-27 21:29:31 +03:00
import { C, D } from "./b2";
(new D(): C);
"
`;
exports[`test c1.js 1`] = `
"// @flow
export function foo(props: { x: number }) { }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow
export function foo(props: { x: number }) {
}
"
`;
exports[`test c2.js 1`] = `
"// @flow
2016-12-27 21:29:31 +03:00
import { foo } from "./c1";
export function bar(props: { x: number }) {
foo({ x: 0 });
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow
2016-12-27 21:29:31 +03:00
import { foo } from "./c1";
export function bar(props: { x: number }) {
2016-12-27 21:29:31 +03:00
foo({ x: [object Number] });
}
"
`;
exports[`test c3.js 1`] = `
"// @flow
2016-12-27 21:29:31 +03:00
import { bar } from "./c2";
bar({ x: 0 });
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow
2016-12-27 21:29:31 +03:00
import { bar } from "./c2";
bar({ x: [object Number] });
"
`;
exports[`test d1.js 1`] = `
"// @flow
export class A {}
export class B {}
export var x = new A;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow
export class A {}
export class B {}
export var x = new A();
"
`;
exports[`test d2.js 1`] = `
"// @flow
2016-12-27 21:29:31 +03:00
import {A, x} from "./d1";
export var y: A = x;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow
2016-12-27 21:29:31 +03:00
import { A, x } from "./d1";
export var y: A = x;
"
`;
exports[`test e1.js 1`] = `
"// @flow
export type Action =
2016-12-27 21:29:31 +03:00
| { type: 'FOO' }
| { type: 'BAR' }
;
export const LIFE = 42;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2016-12-27 21:29:31 +03:00
// @flow
export type Action = { type: "FOO" } | { type: "BAR" };
export const LIFE = [object Number];
"
`;
exports[`test e2.js 1`] = `
"// @flow
2016-12-27 21:29:31 +03:00
import type { Action } from './e1';
const f = (): Action => {
2016-12-27 21:29:31 +03:00
return { type: 'FOO' };
}
2016-12-27 21:29:31 +03:00
import { LIFE } from './e1';
(LIFE: 42);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2016-12-27 21:29:31 +03:00
// @flow
import type { Action } from "./e1";
const f = (): Action => {
return { type: "FOO" };
};
import { LIFE } from "./e1";
(LIFE: 42);
"
`;
exports[`test f1.js 1`] = `
"// @flow
type T = { x: number };
type S = { x: string };
declare var a: T;
declare var b: S;
declare var c: T;
module.exports = { a, b, c };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow
type T = { x: number };
type S = { x: string };
declare var a: T;
declare var b: S;
declare var c: T;
module.exports = { a, b, c };
"
`;
exports[`test f2.js 1`] = `
"// @flow
2016-12-27 21:29:31 +03:00
var { a, b, c } = require('./f1');
(c: { x: number });
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow
2016-12-27 21:29:31 +03:00
var { a, b, c } = require("./f1");
(c: { x: number });
"
`;
exports[`test g1.js 1`] = `
"// @flow
export class C { }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow
export class C {}
"
`;
exports[`test g2.js 1`] = `
"// @flow
2016-12-27 21:29:31 +03:00
import { C } from './g1';
class D extends C { }
module.exports = { D };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow
2016-12-27 21:29:31 +03:00
import { C } from "./g1";
class D extends C {}
module.exports = { D };
"
`;
exports[`test g3.js 1`] = `
"// @flow
2016-12-27 21:29:31 +03:00
import { C } from './g1';
import { D } from './g2';
(new D: C)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow
2016-12-27 21:29:31 +03:00
import { C } from "./g1";
import { D } from "./g2";
(new D(): C);
"
`;
exports[`test h1.js 1`] = `
"// @flow
export type Foo = number;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow
export type Foo = number;
"
`;
exports[`test h2.js 1`] = `
"// @flow
2016-12-27 21:29:31 +03:00
import type { Foo } from './h1';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow
2016-12-27 21:29:31 +03:00
import type { Foo } from "./h1";
"
`;