Files
test-repo/tests/nullable/__snapshots__/jsfmt.spec.js.snap
T
Christopher Chedeau 74bc9e7a4d Add newline for empty blocks {} (#205)
I find it weird to put `{}` together. So I figured I would change it to have an empty line and ask for feedback :)

![image](https://cloud.githubusercontent.com/assets/197597/21739279/062adc80-d44c-11e6-8bb7-5e0768f3ddde.png)

Beware: most of the test cases are not representative of real code, you almost never define blocks with no content in practice.
2017-01-16 11:31:32 -05:00

90 lines
1.7 KiB
Plaintext

exports[`test maybe.js 1`] = `
"// @flow
// unwrapping nested maybes should work
((\'foo\': ?(?string)): ?string); // ok
((123: ?(?number)): ?string); // error (only num ~> string)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow
// unwrapping nested maybes should work
((\"foo\": ??string): ?string);
// ok
((123: ??number): ?string); // error (only num ~> string)
"
`;
exports[`test nullable.js 1`] = `
"function foo():string { return null; }
function bar():?string { return null; }
function qux(x:string) { }
function corge(x:number) { }
var x = bar(); // x: ?string
if (x != null) qux(x); // x: ?string | null
if (x != null) corge(x); // x: ?string | null
function grault() { x = null; }
if (x != null) {
grault(); qux(x);
}
var array_of_nullable: Array<?number> = [null, 3];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function foo(): string {
return null;
}
function bar(): ?string {
return null;
}
function qux(x: string) {
}
function corge(x: number) {
}
var x = bar();
// x: ?string
if (x != null) qux(x);
// x: ?string | null
if (x != null) corge(x);
// x: ?string | null
function grault() {
x = null;
}
if (x != null) {
grault();
qux(x);
}
var array_of_nullable: Array<?number> = [ null, 3 ];
"
`;
exports[`test simple_nullable.js 1`] = `
"function foo(x:?string) {}
function bar(x:?number) {}
foo(\'hmm\');
bar(\'hmm\');
function fn(data: ?{}) {}
fn({some: \'literal\'});
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function foo(x: ?string) {
}
function bar(x: ?number) {
}
foo(\"hmm\");
bar(\"hmm\");
function fn(data: ?{}) {
}
fn({ some: \"literal\" });
"
`;