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

120 lines
2.1 KiB
Plaintext

exports[`test in.js 1`] = `
"// @flow
let tests = [
// objects on RHS
function() {
(\'foo\' in {});
(\'foo\' in { foo: null });
(0 in {});
(0 in { \"0\": null });
},
// arrays on RHS
function() {
(\'foo\' in []);
(0 in []);
(\'length\' in []);
},
// primitive classes on RHS
function() {
(\'foo\' in new String(\'bar\'));
(\'foo\' in new Number(123));
},
// primitives on RHS
function() {
(\'foo\' in 123); // error
(\'foo\' in \'bar\'); // error
(\'foo\' in void 0); // error
(\'foo\' in null); // error
},
// bogus stuff on LHS
function() {
(null in {}); // error
(void 0 in {}); // error
({} in {}); // error
([] in {}); // error
(false in []); // error
},
// in predicates
function() {
if (\'foo\' in 123) {} // error
if (!\'foo\' in {}) {} // error, !\'foo\' is a boolean
if (!(\'foo\' in {})) {}
},
// annotations on RHS
function(x: Object, y: mixed) {
(\'foo\' in x); // ok
(\'foo\' in y); // error
},
]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow
let tests = [
// objects on RHS
function() {
\"foo\" in {};
\"foo\" in { foo: null };
0 in {};
0 in { \"0\": null };
},
// arrays on RHS
function() {
\"foo\" in [];
0 in [];
\"length\" in [];
},
// primitive classes on RHS
function() {
\"foo\" in new String(\"bar\");
\"foo\" in new Number(123);
},
// primitives on RHS
function() {
\"foo\" in 123;
// error
\"foo\" in \"bar\";
// error
\"foo\" in void 0;
// error
\"foo\" in null; // error
},
// bogus stuff on LHS
function() {
null in {};
// error
void 0 in {};
// error
({}) in {};
// error
[] in {};
// error
false in []; // error
},
// in predicates
function() {
if (\"foo\" in 123) {
}
// error
if (!\"foo\" in {}) {
}
// error, !\'foo\' is a boolean
if (!(\"foo\" in {})) {
}
},
// annotations on RHS
function(x: Object, y: mixed) {
\"foo\" in x;
// ok
\"foo\" in y; // error
}
];
"
`;