add comprehensive generation tests
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
var multiples = [for (num of nums) num * num];
|
||||
var multiples = [for (num of nums) for (num2 of nums) num * num];
|
||||
var multiples = [for (num of nums) if (num > 5) num * num];
|
||||
@@ -1,3 +0,0 @@
|
||||
var multiples = [for (num of nums) num * num];
|
||||
var multiples = [for (num of nums) for (num2 of nums) num * num];
|
||||
var multiples = [for (num of nums) if (num > 5) num * num];
|
||||
@@ -1 +0,0 @@
|
||||
var foo = [1, 2, 3];
|
||||
@@ -1 +0,0 @@
|
||||
var foo = [1, 2, 3];
|
||||
@@ -1,17 +0,0 @@
|
||||
var foo = `i
|
||||
am a multiline string`;
|
||||
|
||||
var foo = `i am also
|
||||
a multiline string
|
||||
foobar`;
|
||||
|
||||
var foo = `im a single line string`;
|
||||
|
||||
var foo = tagit`i
|
||||
am a multiline string`;
|
||||
|
||||
var foo = tagit`i am also
|
||||
a multiline string
|
||||
foobar`;
|
||||
|
||||
var foo = tagit`im a single line string`;
|
||||
@@ -1,17 +0,0 @@
|
||||
var foo = `i
|
||||
am a multiline string`;
|
||||
|
||||
var foo = `i am also
|
||||
a multiline string
|
||||
foobar`;
|
||||
|
||||
var foo = `im a single line string`;
|
||||
|
||||
var foo = tagit`i
|
||||
am a multiline string`;
|
||||
|
||||
var foo = tagit`i am also
|
||||
a multiline string
|
||||
foobar`;
|
||||
|
||||
var foo = tagit`im a single line string`;
|
||||
5
test/fixtures/generation/types/ArrayExpression-ArrayPattern/actual.js
vendored
Normal file
5
test/fixtures/generation/types/ArrayExpression-ArrayPattern/actual.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
[a, b, c];
|
||||
[[], [b, c], []];
|
||||
[a,, b,];
|
||||
[a,,,, b];
|
||||
[a, b,, c];
|
||||
5
test/fixtures/generation/types/ArrayExpression-ArrayPattern/expected.js
vendored
Normal file
5
test/fixtures/generation/types/ArrayExpression-ArrayPattern/expected.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
[a, b, c];
|
||||
[[], [b, c], []];
|
||||
[a,, b];
|
||||
[a,,,, b];
|
||||
[a, b,, c];
|
||||
4
test/fixtures/generation/types/ArrowFunctionExpression/actual.js
vendored
Normal file
4
test/fixtures/generation/types/ArrowFunctionExpression/actual.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
var foo = x => x * x;
|
||||
var foo = (a, b) => a * b;
|
||||
var foo = async x => x * x;
|
||||
var foo = async (a, b) => a * b;
|
||||
4
test/fixtures/generation/types/ArrowFunctionExpression/expected.js
vendored
Normal file
4
test/fixtures/generation/types/ArrowFunctionExpression/expected.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
var foo = x => x * x;
|
||||
var foo = (a, b) => a * b;
|
||||
var foo = async x => x * x;
|
||||
var foo = async (a, b) => a * b;
|
||||
@@ -0,0 +1,3 @@
|
||||
foo === bar;
|
||||
foo + bar;
|
||||
foo = bar;
|
||||
@@ -0,0 +1,3 @@
|
||||
foo === bar;
|
||||
foo + bar;
|
||||
foo = bar;
|
||||
7
test/fixtures/generation/types/AwaitExpression/actual.js
vendored
Normal file
7
test/fixtures/generation/types/AwaitExpression/actual.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
async function foo() {
|
||||
await bar();
|
||||
}
|
||||
|
||||
async function bar() {
|
||||
await* foo();
|
||||
}
|
||||
7
test/fixtures/generation/types/AwaitExpression/expected.js
vendored
Normal file
7
test/fixtures/generation/types/AwaitExpression/expected.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
async function foo() {
|
||||
await bar();
|
||||
}
|
||||
|
||||
async function bar() {
|
||||
await* foo();
|
||||
}
|
||||
5
test/fixtures/generation/types/BlockStatement/actual.js
vendored
Normal file
5
test/fixtures/generation/types/BlockStatement/actual.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{}
|
||||
|
||||
{
|
||||
foo();
|
||||
}
|
||||
5
test/fixtures/generation/types/BlockStatement/expected.js
vendored
Normal file
5
test/fixtures/generation/types/BlockStatement/expected.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{}
|
||||
|
||||
{
|
||||
foo();
|
||||
}
|
||||
7
test/fixtures/generation/types/BreakStatement/actual.js
vendored
Normal file
7
test/fixtures/generation/types/BreakStatement/actual.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
for (var i in foo) {
|
||||
break;
|
||||
}
|
||||
|
||||
foo: for (var i in foo) {
|
||||
break foo;
|
||||
}
|
||||
7
test/fixtures/generation/types/BreakStatement/expected.js
vendored
Normal file
7
test/fixtures/generation/types/BreakStatement/expected.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
for (var i in foo) {
|
||||
break;
|
||||
}
|
||||
|
||||
foo: for (var i in foo) {
|
||||
break foo;
|
||||
}
|
||||
5
test/fixtures/generation/types/CallExpression/actual.js
vendored
Normal file
5
test/fixtures/generation/types/CallExpression/actual.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
foo();
|
||||
foo("foo");
|
||||
foo("foo", "bar");
|
||||
foo(bar());
|
||||
foo(bar("test"));
|
||||
5
test/fixtures/generation/types/CallExpression/expected.js
vendored
Normal file
5
test/fixtures/generation/types/CallExpression/expected.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
foo();
|
||||
foo("foo");
|
||||
foo("foo", "bar");
|
||||
foo(bar());
|
||||
foo(bar("test"));
|
||||
13
test/fixtures/generation/types/ClassBody-MethodDefinition/actual.js
vendored
Normal file
13
test/fixtures/generation/types/ClassBody-MethodDefinition/actual.js
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
class Foo {
|
||||
async foo() {}
|
||||
foo() {}
|
||||
["foo"]() {}
|
||||
get foo() {}
|
||||
set foo() {}
|
||||
|
||||
static async foo() {}
|
||||
static foo() {}
|
||||
static ["foo"]() {}
|
||||
static get foo() {}
|
||||
static set foo() {}
|
||||
}
|
||||
13
test/fixtures/generation/types/ClassBody-MethodDefinition/expected.js
vendored
Normal file
13
test/fixtures/generation/types/ClassBody-MethodDefinition/expected.js
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
class Foo {
|
||||
async foo() {}
|
||||
foo() {}
|
||||
["foo"]() {}
|
||||
get foo() {}
|
||||
set foo() {}
|
||||
|
||||
static async foo() {}
|
||||
static foo() {}
|
||||
static ["foo"]() {}
|
||||
static get foo() {}
|
||||
static set foo() {}
|
||||
}
|
||||
2
test/fixtures/generation/types/ClassDeclaration/actual.js
vendored
Normal file
2
test/fixtures/generation/types/ClassDeclaration/actual.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
var foo = class Foo {};
|
||||
var foo = class Foo extends Bar {};
|
||||
2
test/fixtures/generation/types/ClassDeclaration/expected.js
vendored
Normal file
2
test/fixtures/generation/types/ClassDeclaration/expected.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
var foo = class Foo {};
|
||||
var foo = class Foo extends Bar {};
|
||||
2
test/fixtures/generation/types/ClassExpression/actual.js
vendored
Normal file
2
test/fixtures/generation/types/ClassExpression/actual.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
class Foo {}
|
||||
class Foo extends Bar {}
|
||||
2
test/fixtures/generation/types/ClassExpression/expected.js
vendored
Normal file
2
test/fixtures/generation/types/ClassExpression/expected.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
class Foo {}
|
||||
class Foo extends Bar {}
|
||||
9
test/fixtures/generation/types/ComprehensionBlock-ComprehensionExpression/actual.js
vendored
Normal file
9
test/fixtures/generation/types/ComprehensionBlock-ComprehensionExpression/actual.js
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
[for (x of nums) x * x];
|
||||
[for (x of nums) if (x > 2) x * x];
|
||||
[for (nums of nums2) for (x of nums) x * x];
|
||||
[for (nums of nums2) for (x of nums) if (x > 2) x * x];
|
||||
|
||||
(for (x of nums) x * x);
|
||||
(for (x of nums) if (x > 2) x * x);
|
||||
(for (nums of nums2) for (x of nums) x * x);
|
||||
(for (nums of nums2) for (x of nums) if (x > 2) x * x);
|
||||
9
test/fixtures/generation/types/ComprehensionBlock-ComprehensionExpression/expected.js
vendored
Normal file
9
test/fixtures/generation/types/ComprehensionBlock-ComprehensionExpression/expected.js
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
[for (x of nums) x * x];
|
||||
[for (x of nums) if (x > 2) x * x];
|
||||
[for (nums of nums2) for (x of nums) x * x];
|
||||
[for (nums of nums2) for (x of nums) if (x > 2) x * x];
|
||||
|
||||
(for (x of nums) x * x);
|
||||
(for (x of nums) if (x > 2) x * x);
|
||||
(for (nums of nums2) for (x of nums) x * x);
|
||||
(for (nums of nums2) for (x of nums) if (x > 2) x * x);
|
||||
1
test/fixtures/generation/types/ConditionalExpression/actual.js
vendored
Normal file
1
test/fixtures/generation/types/ConditionalExpression/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
foo ? foo : bar;
|
||||
1
test/fixtures/generation/types/ConditionalExpression/expected.js
vendored
Normal file
1
test/fixtures/generation/types/ConditionalExpression/expected.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
foo ? foo : bar;
|
||||
7
test/fixtures/generation/types/ContinueStatement/actual.js
vendored
Normal file
7
test/fixtures/generation/types/ContinueStatement/actual.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
for (var i in foo) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foo: for (var i in foo) {
|
||||
continue foo;
|
||||
}
|
||||
7
test/fixtures/generation/types/ContinueStatement/expected.js
vendored
Normal file
7
test/fixtures/generation/types/ContinueStatement/expected.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
for (var i in foo) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foo: for (var i in foo) {
|
||||
continue foo;
|
||||
}
|
||||
1
test/fixtures/generation/types/DebuggerStatement/actual.js
vendored
Normal file
1
test/fixtures/generation/types/DebuggerStatement/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
debugger;
|
||||
1
test/fixtures/generation/types/DebuggerStatement/expected.js
vendored
Normal file
1
test/fixtures/generation/types/DebuggerStatement/expected.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
debugger;
|
||||
5
test/fixtures/generation/types/DoWhileStatement/actual.js
vendored
Normal file
5
test/fixtures/generation/types/DoWhileStatement/actual.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
do {
|
||||
test();
|
||||
} while (true);
|
||||
|
||||
do {} while (true);
|
||||
5
test/fixtures/generation/types/DoWhileStatement/expected.js
vendored
Normal file
5
test/fixtures/generation/types/DoWhileStatement/expected.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
do {
|
||||
test();
|
||||
} while (true);
|
||||
|
||||
do {} while (true);
|
||||
1
test/fixtures/generation/types/EmptyStatement/actual.js
vendored
Normal file
1
test/fixtures/generation/types/EmptyStatement/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
;
|
||||
1
test/fixtures/generation/types/EmptyStatement/expected.js
vendored
Normal file
1
test/fixtures/generation/types/EmptyStatement/expected.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
;
|
||||
27
test/fixtures/generation/types/ExportDeclaration-ExportSpecifier-ExportBatchSpecifier/actual.js
vendored
Normal file
27
test/fixtures/generation/types/ExportDeclaration-ExportSpecifier-ExportBatchSpecifier/actual.js
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
export default 42;
|
||||
export default {};
|
||||
export default [];
|
||||
export default foo;
|
||||
export default function () {};
|
||||
export default class {};
|
||||
export default function foo() {};
|
||||
export default class Foo {};
|
||||
export * from "foo";
|
||||
export { foo } from "foo";
|
||||
export { foo, bar } from "foo";
|
||||
export { foo as bar } from "foo";
|
||||
export { foo as default } from "foo";
|
||||
export { foo as default, bar } from "foo";
|
||||
export { foo };
|
||||
export { foo, bar };
|
||||
export { foo as bar };
|
||||
export { foo as default };
|
||||
export { foo as default, bar };
|
||||
export var foo = 1;
|
||||
export var foo2 = function () {};
|
||||
export var foo3;
|
||||
export let foo4 = 2;
|
||||
export let foo5;
|
||||
export const foo6 = 3;
|
||||
export function foo7() {}
|
||||
export class foo8 {}
|
||||
@@ -0,0 +1,27 @@
|
||||
export default 42;
|
||||
export default {};
|
||||
export default [];
|
||||
export default foo;
|
||||
export default function () {};
|
||||
export default class {};
|
||||
export default function foo() {};
|
||||
export default class Foo {};
|
||||
export * from "foo";
|
||||
export { foo } from "foo";
|
||||
export { foo, bar } from "foo";
|
||||
export { foo as bar } from "foo";
|
||||
export { foo as default } from "foo";
|
||||
export { foo as default, bar } from "foo";
|
||||
export { foo };
|
||||
export { foo, bar };
|
||||
export { foo as bar };
|
||||
export { foo as default };
|
||||
export { foo as default, bar };
|
||||
export var foo = 1;
|
||||
export var foo2 = function () {};
|
||||
export var foo3;
|
||||
export let foo4 = 2;
|
||||
export let foo5;
|
||||
export const foo6 = 3;
|
||||
export function foo7() {}
|
||||
export class foo8 {}
|
||||
5
test/fixtures/generation/types/ForInStatement/actual.js
vendored
Normal file
5
test/fixtures/generation/types/ForInStatement/actual.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
for (var i in nums) {}
|
||||
|
||||
for (var i in nums) {
|
||||
nums[i] = nums[i] * nums[i];
|
||||
}
|
||||
5
test/fixtures/generation/types/ForInStatement/expected.js
vendored
Normal file
5
test/fixtures/generation/types/ForInStatement/expected.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
for (var i in nums) {}
|
||||
|
||||
for (var i in nums) {
|
||||
nums[i] = nums[i] * nums[i];
|
||||
}
|
||||
5
test/fixtures/generation/types/ForOfStatement/actual.js
vendored
Normal file
5
test/fixtures/generation/types/ForOfStatement/actual.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
for (var x of nums) {}
|
||||
|
||||
for (var x of nums) {
|
||||
console.log(x * x);
|
||||
}
|
||||
5
test/fixtures/generation/types/ForOfStatement/expected.js
vendored
Normal file
5
test/fixtures/generation/types/ForOfStatement/expected.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
for (var x of nums) {}
|
||||
|
||||
for (var x of nums) {
|
||||
console.log(x * x);
|
||||
}
|
||||
3
test/fixtures/generation/types/ForStatement/actual.js
vendored
Normal file
3
test/fixtures/generation/types/ForStatement/actual.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
for (var i = 0;;) {}
|
||||
for (var i = 0; i < 5;) {}
|
||||
for (var i = 0; i < 5; i++) {}
|
||||
3
test/fixtures/generation/types/ForStatement/expected.js
vendored
Normal file
3
test/fixtures/generation/types/ForStatement/expected.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
for (var i = 0;;) {}
|
||||
for (var i = 0; i < 5;) {}
|
||||
for (var i = 0; i < 5; i++) {}
|
||||
23
test/fixtures/generation/types/FunctionDeclaration-FunctionExpression/actual.js
vendored
Normal file
23
test/fixtures/generation/types/FunctionDeclaration-FunctionExpression/actual.js
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
function foo(bar = "bar") {}
|
||||
|
||||
function foo(bar = "bar", ...items) {}
|
||||
|
||||
function foo(...items) {}
|
||||
|
||||
function* foo() {}
|
||||
|
||||
function foo() {}
|
||||
|
||||
async function foo() {}
|
||||
|
||||
var foo = function* foo() {};
|
||||
|
||||
var foo = function foo() {};
|
||||
|
||||
var foo = async function foo() {};
|
||||
|
||||
var foo = function* () {};
|
||||
|
||||
var foo = function () {};
|
||||
|
||||
var foo = async function () {};
|
||||
23
test/fixtures/generation/types/FunctionDeclaration-FunctionExpression/expected.js
vendored
Normal file
23
test/fixtures/generation/types/FunctionDeclaration-FunctionExpression/expected.js
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
function foo(bar = "bar") {}
|
||||
|
||||
function foo(bar = "bar", ...items) {}
|
||||
|
||||
function foo(...items) {}
|
||||
|
||||
function* foo() {}
|
||||
|
||||
function foo() {}
|
||||
|
||||
async function foo() {}
|
||||
|
||||
var foo = function* foo() {};
|
||||
|
||||
var foo = function foo() {};
|
||||
|
||||
var foo = async function foo() {};
|
||||
|
||||
var foo = function* () {};
|
||||
|
||||
var foo = function () {};
|
||||
|
||||
var foo = async function () {};
|
||||
2
test/fixtures/generation/types/Identifier/actual.js
vendored
Normal file
2
test/fixtures/generation/types/Identifier/actual.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
foo;
|
||||
undefined;
|
||||
2
test/fixtures/generation/types/Identifier/expected.js
vendored
Normal file
2
test/fixtures/generation/types/Identifier/expected.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
foo;
|
||||
undefined;
|
||||
25
test/fixtures/generation/types/IfStatement/actual.js
vendored
Normal file
25
test/fixtures/generation/types/IfStatement/actual.js
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
if (foo) foobar();
|
||||
|
||||
if (foo) {
|
||||
foobar();
|
||||
}
|
||||
|
||||
if (foo) {}
|
||||
|
||||
if (foo) {
|
||||
foo();
|
||||
} else bar();
|
||||
|
||||
if (foo) {
|
||||
foo();
|
||||
} else {
|
||||
bar();
|
||||
}
|
||||
|
||||
if (foo) {
|
||||
foo();
|
||||
} else if (bar) {
|
||||
foobar();
|
||||
} else {
|
||||
bar();
|
||||
}
|
||||
25
test/fixtures/generation/types/IfStatement/expected.js
vendored
Normal file
25
test/fixtures/generation/types/IfStatement/expected.js
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
if (foo) foobar();
|
||||
|
||||
if (foo) {
|
||||
foobar();
|
||||
}
|
||||
|
||||
if (foo) {}
|
||||
|
||||
if (foo) {
|
||||
foo();
|
||||
} else bar();
|
||||
|
||||
if (foo) {
|
||||
foo();
|
||||
} else {
|
||||
bar();
|
||||
}
|
||||
|
||||
if (foo) {
|
||||
foo();
|
||||
} else if (bar) {
|
||||
foobar();
|
||||
} else {
|
||||
bar();
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import "foo";
|
||||
import foo from "foo";
|
||||
import { default as foo } from "foo";
|
||||
import * as foo from "foo";
|
||||
import foo, { baz as xyz } from "foo";
|
||||
import { bar } from "foo";
|
||||
import { bar, baz } from "foo";
|
||||
import { bar as baz } from "foo";
|
||||
import { bar as baz, xyz } from "foo";
|
||||
@@ -0,0 +1,9 @@
|
||||
import "foo";
|
||||
import foo from "foo";
|
||||
import { default as foo } from "foo";
|
||||
import * as foo from "foo";
|
||||
import foo, { baz as xyz } from "foo";
|
||||
import { bar } from "foo";
|
||||
import { bar, baz } from "foo";
|
||||
import { bar as baz } from "foo";
|
||||
import { bar as baz, xyz } from "foo";
|
||||
1
test/fixtures/generation/types/LabeledStatement/actual.js
vendored
Normal file
1
test/fixtures/generation/types/LabeledStatement/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
label: for (var i in test) {}
|
||||
1
test/fixtures/generation/types/LabeledStatement/expected.js
vendored
Normal file
1
test/fixtures/generation/types/LabeledStatement/expected.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
label: for (var i in test) {}
|
||||
6
test/fixtures/generation/types/Literal/actual.js
vendored
Normal file
6
test/fixtures/generation/types/Literal/actual.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
5;
|
||||
"foobar";
|
||||
/foobar/g;
|
||||
null;
|
||||
true;
|
||||
false;
|
||||
6
test/fixtures/generation/types/Literal/expected.js
vendored
Normal file
6
test/fixtures/generation/types/Literal/expected.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
5;
|
||||
"foobar";
|
||||
/foobar/g;
|
||||
null;
|
||||
true;
|
||||
false;
|
||||
8
test/fixtures/generation/types/MemberExpression/actual.js
vendored
Normal file
8
test/fixtures/generation/types/MemberExpression/actual.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
foo["bar"];
|
||||
foo.bar;
|
||||
|
||||
foo.bar.foo;
|
||||
foo.bar["foo"];
|
||||
|
||||
foo["foo"]["bar"];
|
||||
foo[test()][bar()];
|
||||
8
test/fixtures/generation/types/MemberExpression/expected.js
vendored
Normal file
8
test/fixtures/generation/types/MemberExpression/expected.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
foo["bar"];
|
||||
foo.bar;
|
||||
|
||||
foo.bar.foo;
|
||||
foo.bar["foo"];
|
||||
|
||||
foo["foo"]["bar"];
|
||||
foo[test()][bar()];
|
||||
3
test/fixtures/generation/types/NewExpression/actual.js
vendored
Normal file
3
test/fixtures/generation/types/NewExpression/actual.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
new Foo;
|
||||
new Foo();
|
||||
new Foo(bar);
|
||||
3
test/fixtures/generation/types/NewExpression/expected.js
vendored
Normal file
3
test/fixtures/generation/types/NewExpression/expected.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
new Foo();
|
||||
new Foo();
|
||||
new Foo(bar);
|
||||
20
test/fixtures/generation/types/ObjectExpression-ObjectPattern-Property/actual.js
vendored
Normal file
20
test/fixtures/generation/types/ObjectExpression-ObjectPattern-Property/actual.js
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
var foo = {};
|
||||
|
||||
var foo = { x, y };
|
||||
|
||||
var foo = { x: x, y: y };
|
||||
|
||||
var foo = {
|
||||
x: x,
|
||||
y: y
|
||||
};
|
||||
|
||||
var foo = {
|
||||
["bar"]: "foo",
|
||||
["foo"]() {},
|
||||
foo() {},
|
||||
async foo() {},
|
||||
*foo() {},
|
||||
get foo() {},
|
||||
set foo() {}
|
||||
};
|
||||
20
test/fixtures/generation/types/ObjectExpression-ObjectPattern-Property/expected.js
vendored
Normal file
20
test/fixtures/generation/types/ObjectExpression-ObjectPattern-Property/expected.js
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
var foo = {};
|
||||
|
||||
var foo = { x, y };
|
||||
|
||||
var foo = { x: x, y: y };
|
||||
|
||||
var foo = {
|
||||
x: x,
|
||||
y: y
|
||||
};
|
||||
|
||||
var foo = {
|
||||
["bar"]: "foo",
|
||||
["foo"]() {},
|
||||
foo() {},
|
||||
async foo() {},
|
||||
*foo() {},
|
||||
get foo() {},
|
||||
set foo() {}
|
||||
};
|
||||
2
test/fixtures/generation/types/ParenthesizedExpression/actual.js
vendored
Normal file
2
test/fixtures/generation/types/ParenthesizedExpression/actual.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
(foo());
|
||||
(5 * 6);
|
||||
2
test/fixtures/generation/types/ParenthesizedExpression/expected.js
vendored
Normal file
2
test/fixtures/generation/types/ParenthesizedExpression/expected.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
(foo());
|
||||
(5 * 6);
|
||||
7
test/fixtures/generation/types/ReturnStatement/actual.js
vendored
Normal file
7
test/fixtures/generation/types/ReturnStatement/actual.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
function foo() {
|
||||
return;
|
||||
}
|
||||
|
||||
function bar() {
|
||||
return "foo";
|
||||
}
|
||||
7
test/fixtures/generation/types/ReturnStatement/expected.js
vendored
Normal file
7
test/fixtures/generation/types/ReturnStatement/expected.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
function foo() {
|
||||
return;
|
||||
}
|
||||
|
||||
function bar() {
|
||||
return "foo";
|
||||
}
|
||||
4
test/fixtures/generation/types/SequenceExpression/actual.js
vendored
Normal file
4
test/fixtures/generation/types/SequenceExpression/actual.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
foo, bar;
|
||||
|
||||
foo,
|
||||
bar;
|
||||
4
test/fixtures/generation/types/SequenceExpression/expected.js
vendored
Normal file
4
test/fixtures/generation/types/SequenceExpression/expected.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
foo, bar;
|
||||
|
||||
foo,
|
||||
bar;
|
||||
3
test/fixtures/generation/types/SpreadElement/actual.js
vendored
Normal file
3
test/fixtures/generation/types/SpreadElement/actual.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[...foo];
|
||||
foo(bar, ...items);
|
||||
new Foo(...foo);
|
||||
3
test/fixtures/generation/types/SpreadElement/expected.js
vendored
Normal file
3
test/fixtures/generation/types/SpreadElement/expected.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[...foo];
|
||||
foo(bar, ...items);
|
||||
new Foo(...foo);
|
||||
39
test/fixtures/generation/types/SwitchStatement-SwitchCase/actual.js
vendored
Normal file
39
test/fixtures/generation/types/SwitchStatement-SwitchCase/actual.js
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
switch (foo) {}
|
||||
|
||||
switch (foo) {
|
||||
case "foo":
|
||||
}
|
||||
|
||||
switch (foo) {
|
||||
default:
|
||||
}
|
||||
|
||||
switch (foo) {
|
||||
case "foo":
|
||||
default:
|
||||
}
|
||||
|
||||
switch (foo) {
|
||||
case "foo":
|
||||
case "bar":
|
||||
default:
|
||||
}
|
||||
|
||||
switch (foo) {
|
||||
case "foo":
|
||||
foo();
|
||||
break;
|
||||
|
||||
case "bar":
|
||||
bar();
|
||||
break;
|
||||
|
||||
default:
|
||||
yay();
|
||||
}
|
||||
|
||||
switch (foo) {
|
||||
case "foo": foo();
|
||||
case "bar": bar();
|
||||
default: yay();
|
||||
}
|
||||
39
test/fixtures/generation/types/SwitchStatement-SwitchCase/expected.js
vendored
Normal file
39
test/fixtures/generation/types/SwitchStatement-SwitchCase/expected.js
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
switch (foo) {}
|
||||
|
||||
switch (foo) {
|
||||
case "foo":
|
||||
}
|
||||
|
||||
switch (foo) {
|
||||
default:
|
||||
}
|
||||
|
||||
switch (foo) {
|
||||
case "foo":
|
||||
default:
|
||||
}
|
||||
|
||||
switch (foo) {
|
||||
case "foo":
|
||||
case "bar":
|
||||
default:
|
||||
}
|
||||
|
||||
switch (foo) {
|
||||
case "foo":
|
||||
foo();
|
||||
break;
|
||||
|
||||
case "bar":
|
||||
bar();
|
||||
break;
|
||||
|
||||
default:
|
||||
yay();
|
||||
}
|
||||
|
||||
switch (foo) {
|
||||
case "foo": foo();
|
||||
case "bar": bar();
|
||||
default: yay();
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
html`<b></b>`;
|
||||
|
||||
`multi
|
||||
lines`;
|
||||
|
||||
`test ${ interpolation } test`;
|
||||
|
||||
`foob
|
||||
|
||||
asdf
|
||||
awer
|
||||
erqer`;
|
||||
@@ -0,0 +1,12 @@
|
||||
html`<b></b>`;
|
||||
|
||||
`multi
|
||||
lines`;
|
||||
|
||||
`test ${ interpolation } test`;
|
||||
|
||||
`foob
|
||||
|
||||
asdf
|
||||
awer
|
||||
erqer`;
|
||||
5
test/fixtures/generation/types/ThisExpression/actual.js
vendored
Normal file
5
test/fixtures/generation/types/ThisExpression/actual.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
this;
|
||||
this.foo;
|
||||
this["foo"];
|
||||
this.foo();
|
||||
this["foo"]();
|
||||
5
test/fixtures/generation/types/ThisExpression/expected.js
vendored
Normal file
5
test/fixtures/generation/types/ThisExpression/expected.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
this;
|
||||
this.foo;
|
||||
this["foo"];
|
||||
this.foo();
|
||||
this["foo"]();
|
||||
3
test/fixtures/generation/types/ThrowStatement/actual.js
vendored
Normal file
3
test/fixtures/generation/types/ThrowStatement/actual.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
throw err;
|
||||
throw Error("foobar");
|
||||
throw new Error("foobar");
|
||||
3
test/fixtures/generation/types/ThrowStatement/expected.js
vendored
Normal file
3
test/fixtures/generation/types/ThrowStatement/expected.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
throw err;
|
||||
throw Error("foobar");
|
||||
throw new Error("foobar");
|
||||
25
test/fixtures/generation/types/TryStatement-CatchClause/actual.js
vendored
Normal file
25
test/fixtures/generation/types/TryStatement-CatchClause/actual.js
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
try {} catch (err) {}
|
||||
|
||||
try {
|
||||
bar;
|
||||
} catch (err) {}
|
||||
|
||||
try {
|
||||
bar;
|
||||
} catch (err) {
|
||||
foo();
|
||||
}
|
||||
|
||||
try {
|
||||
bar;
|
||||
} catch (err) {
|
||||
foo();
|
||||
} finally {
|
||||
yay();
|
||||
}
|
||||
|
||||
try {
|
||||
bar;
|
||||
} catch (err) {
|
||||
foo();
|
||||
} finally {}
|
||||
25
test/fixtures/generation/types/TryStatement-CatchClause/expected.js
vendored
Normal file
25
test/fixtures/generation/types/TryStatement-CatchClause/expected.js
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
try {} catch (err) {}
|
||||
|
||||
try {
|
||||
bar;
|
||||
} catch (err) {}
|
||||
|
||||
try {
|
||||
bar;
|
||||
} catch (err) {
|
||||
foo();
|
||||
}
|
||||
|
||||
try {
|
||||
bar;
|
||||
} catch (err) {
|
||||
foo();
|
||||
} finally {
|
||||
yay();
|
||||
}
|
||||
|
||||
try {
|
||||
bar;
|
||||
} catch (err) {
|
||||
foo();
|
||||
} finally {}
|
||||
5
test/fixtures/generation/types/UnaryExpression/actual.js
vendored
Normal file
5
test/fixtures/generation/types/UnaryExpression/actual.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
delete delete i;
|
||||
+ +i;
|
||||
!!i;
|
||||
+ ++i;
|
||||
- --i;
|
||||
5
test/fixtures/generation/types/UnaryExpression/expected.js
vendored
Normal file
5
test/fixtures/generation/types/UnaryExpression/expected.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
delete delete i;
|
||||
+ +i;
|
||||
!!i;
|
||||
+ ++i;
|
||||
- --i;
|
||||
2
test/fixtures/generation/types/UpdateExpression/actual.js
vendored
Normal file
2
test/fixtures/generation/types/UpdateExpression/actual.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
++i;
|
||||
i++;
|
||||
2
test/fixtures/generation/types/UpdateExpression/expected.js
vendored
Normal file
2
test/fixtures/generation/types/UpdateExpression/expected.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
++i;
|
||||
i++;
|
||||
13
test/fixtures/generation/types/VariableDeclaration-VariableDeclarator/actual.js
vendored
Normal file
13
test/fixtures/generation/types/VariableDeclaration-VariableDeclarator/actual.js
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
let foo;
|
||||
var foo;
|
||||
|
||||
let foo = "foo";
|
||||
var foo = "bar";
|
||||
const foo = "foo";
|
||||
|
||||
let foo, bar = "bar";
|
||||
var foo, bar = "bar";
|
||||
|
||||
let foo = "foo", bar = "bar";
|
||||
var foo = "foo", bar = "bar";
|
||||
const foo = "foo", bar = "bar";
|
||||
13
test/fixtures/generation/types/VariableDeclaration-VariableDeclarator/expected.js
vendored
Normal file
13
test/fixtures/generation/types/VariableDeclaration-VariableDeclarator/expected.js
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
let foo;
|
||||
var foo;
|
||||
|
||||
let foo = "foo";
|
||||
var foo = "bar";
|
||||
const foo = "foo";
|
||||
|
||||
let foo, bar = "bar";
|
||||
var foo, bar = "bar";
|
||||
|
||||
let foo = "foo", bar = "bar";
|
||||
var foo = "foo", bar = "bar";
|
||||
const foo = "foo", bar = "bar";
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user