Files
test-repo/tests/facebookisms/__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

239 lines
5.2 KiB
Plaintext

exports[`test Bar.js 1`] = `
"var Bar = { x: 0 };
module.exports = Bar;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var Bar = { x: 0 };
module.exports = Bar;
"
`;
exports[`test copyProperties.js 1`] = `
"// @flow
let tests = [
// global
function() {
(copyProperties()); // error, unknown global
},
// annotation
function(copyProperties: Object$Assign) {
let result = {};
result.baz = false;
(copyProperties(
result,
{ foo: \'a\' },
{ bar: 123 }
): { foo: string, bar: number, baz: boolean });
},
// module from lib
function() {
const copyProperties = require(\'copyProperties\');
let x = { foo: \'a\' };
let y = { bar: 123 };
(copyProperties({}, x, y): { foo: string, bar: number });
},
// too few args
function(copyProperties: Object$Assign) {
copyProperties();
(copyProperties({ foo: \'a\' }): { foo: number }); // err, num !~> string
},
// passed as a function
function(copyProperties: Object$Assign) {
function x(cb: Function) {}
x(copyProperties);
}
];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow
let tests = [
// global
function() {
copyProperties(); // error, unknown global
},
// annotation
function(copyProperties: Object$Assign) {
let result = {};
result.baz = false;
(copyProperties(result, { foo: \"a\" }, { bar: 123 }): {
foo: string,
bar: number,
baz: boolean
});
},
// module from lib
function() {
const copyProperties = require(\"copyProperties\");
let x = { foo: \"a\" };
let y = { bar: 123 };
(copyProperties({}, x, y): { foo: string, bar: number });
},
// too few args
function(copyProperties: Object$Assign) {
copyProperties();
(copyProperties({ foo: \"a\" }): { foo: number }); // err, num !~> string
},
// passed as a function
function(copyProperties: Object$Assign) {
function x(cb: Function) {
}
x(copyProperties);
}
];
"
`;
exports[`test invariant.js 1`] = `
"/* @flow */
let tests = [
function() {
let x: ?string = null;
invariant(x, \'truthy only\'); // error, forgot to require invariant
},
function(invariant: Function) {
let x: ?string = null;
invariant(x);
(x: string);
}
]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* @flow */
let tests = [
function() {
let x: ?string = null;
invariant(x, \"truthy only\"); // error, forgot to require invariant
},
function(invariant: Function) {
let x: ?string = null;
invariant(x);
(x: string);
}
];
"
`;
exports[`test lib.js 1`] = `
"declare module \"copyProperties\" {
declare var exports: Object$Assign;
}
declare module \"mergeInto\" {
declare var exports: $Facebookism$MergeInto;
}
declare module \"mixin\" {
declare var exports: $Facebookism$Mixin;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
declare module \"copyProperties\" {
declare var exports: Object$Assign;
}
declare module \"mergeInto\" {
declare var exports: $Facebookism$MergeInto;
}
declare module \"mixin\" {
declare var exports: $Facebookism$Mixin;
}
"
`;
exports[`test mergeInto.js 1`] = `
"// @flow
let tests = [
// global
function() {
(mergeInto()); // error, unknown global
},
// annotation
function(mergeInto: $Facebookism$MergeInto) {
let result = {};
result.baz = false;
(mergeInto(result, { foo: \'a\' }, { bar: 123 }): void);
(result: { foo: string, bar: number, baz: boolean });
},
// module from lib
function() {
const mergeInto = require(\'mergeInto\');
let result: { foo?: string, bar?: number, baz: boolean } = { baz: false };
(mergeInto(result, { foo: \'a\' }, { bar: 123 }): void);
},
// too few args
function(mergeInto: $Facebookism$MergeInto) {
mergeInto();
},
// passed as a function
function(mergeInto: $Facebookism$MergeInto) {
function x(cb: Function) {}
x(mergeInto);
}
];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow
let tests = [
// global
function() {
mergeInto(); // error, unknown global
},
// annotation
function(mergeInto: $Facebookism$MergeInto) {
let result = {};
result.baz = false;
(mergeInto(result, { foo: \"a\" }, { bar: 123 }): void);
(result: { foo: string, bar: number, baz: boolean });
},
// module from lib
function() {
const mergeInto = require(\"mergeInto\");
let result: { foo?: string, bar?: number, baz: boolean } = { baz: false };
(mergeInto(result, { foo: \"a\" }, { bar: 123 }): void);
},
// too few args
function(mergeInto: $Facebookism$MergeInto) {
mergeInto();
},
// passed as a function
function(mergeInto: $Facebookism$MergeInto) {
function x(cb: Function) {
}
x(mergeInto);
}
];
"
`;
exports[`test test.js 1`] = `
"var Bar = require(\'./Bar\');
var mixin = require(\'mixin\');
class Foo extends mixin(Bar) {
m() {
var x: string = this.x;
this.y = \"\";
}
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var Bar = require(\"./Bar\");
var mixin = require(\"mixin\");
class Foo extends mixin(Bar) {
m() {
var x: string = this.x;
this.y = \"\";
}
}
"
`;