From 3bd6ec20c1ba4b9288307c8ecd55b157a1579895 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 5 Jan 2015 12:38:26 +1100 Subject: [PATCH] remove regenerator tests and git submodule regenerator --- .gitmodules | 3 + .../transformation/es6-generators/LICENSE | 7 -- .../exec.js | 24 ---- .../exec.js | 22 ---- .../exec.js | 15 --- .../exec.js | 22 ---- .../exec.js | 32 ----- .../es6-generators/collatz-generator/exec.js | 42 ------- .../completed-generator/exec.js | 11 -- .../exec.js | 27 ----- .../exec.js | 10 -- .../exec.js | 12 -- .../exec.js | 37 ------ .../exec.js | 15 --- .../exec.js | 18 --- .../exec.js | 11 -- .../exec.js | 20 --- .../exec.js | 16 --- .../exec.js | 19 --- .../exec.js | 13 -- .../exec.js | 26 ---- .../exec.js | 12 -- .../exec.js | 16 --- .../exec.js | 7 -- .../exec.js | 5 - .../exec.js | 10 -- .../exec.js | 45 ------- .../exec.js | 24 ---- .../exec.js | 15 --- .../exec.js | 6 - .../exec.js | 60 --------- .../exec.js | 18 --- .../exec.js | 22 ---- .../exec.js | 12 -- .../exec.js | 16 --- .../exec.js | 16 --- .../exec.js | 20 --- .../exec.js | 16 --- .../exec.js | 14 --- .../infinite-sequence-generator/exec.js | 41 ------- .../exec.js | 19 --- .../exec.js | 13 -- .../exec.js | 82 ------------- .../nested-finally-blocks/exec.js | 41 ------- .../exec.js | 18 --- .../exec.js | 22 ---- .../exec.js | 40 ------ .../exec.js | 29 ----- .../exec.js | 58 --------- .../exec.js | 9 -- .../exec.js | 17 --- .../es6-generators/range-generator/exec.js | 9 -- .../exec.js | 5 - .../exec.js | 6 - .../exec.js | 11 -- .../exec.js | 7 -- .../exec.js | 12 -- .../throw-should-complete-generator/exec.js | 13 -- .../try-catch-finally-generator/exec.js | 42 ------- .../try-catch-generator/exec.js | 33 ----- .../try-finally-generator/exec.js | 114 ------------------ .../exec.js | 26 ---- .../exec.js | 6 - .../exec.js | 22 ---- .../exec.js | 11 -- .../es7-async-functions/LICENSE | 7 -- .../exec.js | 26 ---- .../exec.js | 40 ------ .../exec.js | 15 --- .../exec.js | 19 --- .../es7-async-functions/options.json | 4 - .../exec.js | 42 ------- .../exec.js | 21 ---- test/regenerator.js | 21 ++++ vendor/regenerator | 1 + 75 files changed, 25 insertions(+), 1613 deletions(-) delete mode 100644 test/fixtures/transformation/es6-generators/LICENSE delete mode 100644 test/fixtures/transformation/es6-generators/block-binding-should-translate-block-binding-correctly/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/block-binding-should-translate-block-binding-with-iife-correctly/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/catch-parameter-shadowing-should-allow-nested-catch-parameters-of-the-same-name/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/catch-parameter-shadowing-should-leave-outer-variables-unmodified/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/catch-parameter-shadowing-should-not-replace-variables-defined-in-inner-scopes/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/collatz-generator/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/completed-generator/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/delegated-yield-should-be-governed-by-enclosing-try-statements/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/delegated-yield-should-cope-with-empty-delegatees/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/delegated-yield-should-delegate-correctly/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/delegated-yield-should-dispatch-thrown-exceptions-correctly/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/delegated-yield-should-pass-sent-values-through/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/delegated-yield-should-support-deeper-nesting/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/delegated-yieldshould-support-any-iterable-argument/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/dynamic-exception-should-be-dispatched-correctly/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/empty-while-loops-should-be-preserved-in-generated-code/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/for-in-loop-generator-should-handle-break-in-loop/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/for-in-loop-generator-should-handle-property-deletion-in-loop/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/for-in-loop-generator-should-handle-risky-object-expressions/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/for-in-loop-generator-should-handle-the-simple-case/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/for-in-loop-generator-should-loop-over-inherited-properties/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/for-loop-with-var-decl-and-no-update-expression-should-compile-and-run/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/for-of-loops-should-work-for-Arrays/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/for-of-loops-should-work-for-generators/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/for-of-loops-should-work-inside-of-generators/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/function-declaration-hoisting-should-work-even-if-the-declarations-are-out-of-order/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/function-declaration-hoisting-should-work-for-nested-generator-function-declarations/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/generator-function-expression-should-behave-just-like-a-declared-generator/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/generator-function-prototype-should-follow-the-expected-object-model/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/generator-reentry-attempt-should-complain-with-a-TypeError/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/generator-return-method-should-behave-as-if-generator-actually-returned/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/generator-return-method-should-work-with-newborn-generators/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/generator-throw-method-should-complete-generator/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/generator-throw-method-should-immediately-complete-a-new-born-generator/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/generator-throw-method-should-not-propagate-errors-handled-inside-a-delegate/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/generator-throw-method-should-propagate-errors-unhandled-inside-a-delegate/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/generator-throw-method-should-work-after-the-final-call-to-next/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/infinite-sequence-generator/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/isGeneratorFunction-should-work-for-function-declarations/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/isGeneratorFunction-should-work-for-function-expressions/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/labeled-break-and-continue-statements-should-be-able-to-exit-multiple-try-statements/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/nested-finally-blocks/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/nested-generators-in-try-catch-should-get-a-reference-to-the-caught-error/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/new-expressions-should-be-able-to-contain-yield-sub-expressions/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/newborn-generators-should-allow-chaining-newborn-and-non-newborn-generators/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/newborn-generators-should-be-able-to-yield-star-non-newborn-generators/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/newborn-generators-should-support-the-ignore-initial-yield-wrapper-idiom/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/object-literal-generator-should-yield-the-correct-object/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/object-literals-with-multiple-yields-should-receive-different-sent-values/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/range-generator/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/should-support-multiple-yields-in-expression/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/should-yield-only-its-first-argument/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/switch-statement-generator-should-jump-to-the-correct-cases/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/the-arguments-object-should-not-get-confused-by-properties/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/the-arguments-object-should-work-in-simple-variadic-functions/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/throw-should-complete-generator/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/try-catch-finally-generator/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/try-catch-generator/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/try-finally-generator/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/unqualified-function-calls-should-have-a-global-`this`-object/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/yield-chain-should-have-correct-associativity/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/yield-star-expression-results-can-be-used-in-complex-expressions/exec.js delete mode 100644 test/fixtures/transformation/es6-generators/yield-star-expression-results-have-correct-values/exec.js delete mode 100644 test/fixtures/transformation/es7-async-functions/LICENSE delete mode 100644 test/fixtures/transformation/es7-async-functions/dependent-promises-should-be-awaitable-out-of-order/exec.js delete mode 100644 test/fixtures/transformation/es7-async-functions/nested-async-function-calls-should-evaluate-in-the-right-order/exec.js delete mode 100644 test/fixtures/transformation/es7-async-functions/no-await-async-function-should-return-a-Promise/exec.js delete mode 100644 test/fixtures/transformation/es7-async-functions/one-await-async-function-should-finish-asynchronously/exec.js delete mode 100644 test/fixtures/transformation/es7-async-functions/options.json delete mode 100644 test/fixtures/transformation/es7-async-functions/rejected-promises-should-be-returned-by-exceptional-async-functions/exec.js delete mode 100644 test/fixtures/transformation/es7-async-functions/rejected-promises-should-cause-await-expressions-to-throw/exec.js create mode 100644 test/regenerator.js create mode 160000 vendor/regenerator diff --git a/.gitmodules b/.gitmodules index d5327c7e27..fbbbb71463 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "vendor/traceur"] path = vendor/traceur url = https://github.com/google/traceur-compiler +[submodule "vendor/regenerator"] + path = vendor/regenerator + url = https://github.com/facebook/regenerator diff --git a/test/fixtures/transformation/es6-generators/LICENSE b/test/fixtures/transformation/es6-generators/LICENSE deleted file mode 100644 index eba1d817f5..0000000000 --- a/test/fixtures/transformation/es6-generators/LICENSE +++ /dev/null @@ -1,7 +0,0 @@ -Copyright (c) 2014, Facebook, Inc. -All rights reserved. - -This source code is licensed under the BSD-style license found in the -https://raw.github.com/facebook/regenerator/master/LICENSE file. An -additional grant of patent rights can be found in the PATENTS file in -the same directory. diff --git a/test/fixtures/transformation/es6-generators/block-binding-should-translate-block-binding-correctly/exec.js b/test/fixtures/transformation/es6-generators/block-binding-should-translate-block-binding-correctly/exec.js deleted file mode 100644 index 140f327a37..0000000000 --- a/test/fixtures/transformation/es6-generators/block-binding-should-translate-block-binding-correctly/exec.js +++ /dev/null @@ -1,24 +0,0 @@ -function *gen() { - var a$0 = 0, a$1 = 1; - - let a = 3; - - { - let a = 1; - yield a + a$0; - } - - { - let a = 2; - yield a - 1 + a$1; - } - - yield a; -} - -var g = gen(); - -assert.deepEqual(g.next(), { value: 1, done: false }); -assert.deepEqual(g.next(), { value: 2, done: false }); -assert.deepEqual(g.next(), { value: 3, done: false }); -assert.deepEqual(g.next(), { value: void 0, done: true }); diff --git a/test/fixtures/transformation/es6-generators/block-binding-should-translate-block-binding-with-iife-correctly/exec.js b/test/fixtures/transformation/es6-generators/block-binding-should-translate-block-binding-with-iife-correctly/exec.js deleted file mode 100644 index 3edc3451b3..0000000000 --- a/test/fixtures/transformation/es6-generators/block-binding-should-translate-block-binding-with-iife-correctly/exec.js +++ /dev/null @@ -1,22 +0,0 @@ -function *gen() { - let arr = []; - - for (let x = 0; x < 3; x++) { - let y = x; - arr.push(function() { return y; }); - } - - { - let x; - while( x = arr.pop() ) { - yield x; - } - } -} - -var g = gen(); - -assert.equal(g.next().value(), 2); -assert.equal(g.next().value(), 1); -assert.equal(g.next().value(), 0); -assert.deepEqual(g.next(), { value: void 0, done: true }); diff --git a/test/fixtures/transformation/es6-generators/catch-parameter-shadowing-should-allow-nested-catch-parameters-of-the-same-name/exec.js b/test/fixtures/transformation/es6-generators/catch-parameter-shadowing-should-allow-nested-catch-parameters-of-the-same-name/exec.js deleted file mode 100644 index bfa31390c1..0000000000 --- a/test/fixtures/transformation/es6-generators/catch-parameter-shadowing-should-allow-nested-catch-parameters-of-the-same-name/exec.js +++ /dev/null @@ -1,15 +0,0 @@ -function *gen() { - try { - genHelpers.raise("e1"); - } catch (e) { - yield e; - try { - genHelpers.raise("e2"); - } catch (e) { - yield e; - } - yield e; - } -} - -genHelpers.check(gen(), ["e1", "e2", "e1"]); diff --git a/test/fixtures/transformation/es6-generators/catch-parameter-shadowing-should-leave-outer-variables-unmodified/exec.js b/test/fixtures/transformation/es6-generators/catch-parameter-shadowing-should-leave-outer-variables-unmodified/exec.js deleted file mode 100644 index cedc2ee2d7..0000000000 --- a/test/fixtures/transformation/es6-generators/catch-parameter-shadowing-should-leave-outer-variables-unmodified/exec.js +++ /dev/null @@ -1,22 +0,0 @@ -function *gen(x) { - var y = x + 1; - try { - throw x + 2; - } catch (x) { - yield x; - x += 1; - yield x; - } - yield x; - try { - throw x + 3; - } catch (y) { - yield y; - y *= 2; - yield y; - } - yield y; -} - -genHelpers.check(gen(1), [3, 4, 1, 4, 8, 2]); -genHelpers.check(gen(2), [4, 5, 2, 5, 10, 3]); diff --git a/test/fixtures/transformation/es6-generators/catch-parameter-shadowing-should-not-replace-variables-defined-in-inner-scopes/exec.js b/test/fixtures/transformation/es6-generators/catch-parameter-shadowing-should-not-replace-variables-defined-in-inner-scopes/exec.js deleted file mode 100644 index e5e527e3c3..0000000000 --- a/test/fixtures/transformation/es6-generators/catch-parameter-shadowing-should-not-replace-variables-defined-in-inner-scopes/exec.js +++ /dev/null @@ -1,32 +0,0 @@ -function *gen(x) { - try { - throw x; - } catch (x) { - yield x; - - yield (function(x) { - return x += 1; - }(x + 1)); - - yield (function() { - var x = arguments[0]; - return x * 2; - }(x + 2)); - - yield (function() { - function notCalled(x) { - throw x; - } - - x >>= 1; - return x; - }()); - - yield x -= 1; - } - - yield x; -} - -genHelpers.check(gen(10), [10, 12, 24, 5, 4, 10]); -genHelpers.check(gen(11), [11, 13, 26, 5, 4, 11]); diff --git a/test/fixtures/transformation/es6-generators/collatz-generator/exec.js b/test/fixtures/transformation/es6-generators/collatz-generator/exec.js deleted file mode 100644 index 9bc63db1e9..0000000000 --- a/test/fixtures/transformation/es6-generators/collatz-generator/exec.js +++ /dev/null @@ -1,42 +0,0 @@ -function *gen(n) { - var count = 0; - - yield n; - - while (n !== 1) { - count += 1; - - if (n % 2) { - yield n = n * 3 + 1; - } else { - yield n >>= 1; - } - } - - return count; -} - -function collatz(n) { - var result = [n]; - - while (n !== 1) { - if (n % 2) { - n *= 3; - n += 1; - } else { - n >>= 1; - } - - result.push(n); - } - - return result; -} - -var seven = collatz(7); -var fiftyTwo = seven.slice(seven.indexOf(52)); -var eightyTwo = collatz(82); - -genHelpers.check(gen(7), seven, 16); -genHelpers.check(gen(52), fiftyTwo, 11); -genHelpers.check(gen(82), eightyTwo, 110); diff --git a/test/fixtures/transformation/es6-generators/completed-generator/exec.js b/test/fixtures/transformation/es6-generators/completed-generator/exec.js deleted file mode 100644 index 540636d9d3..0000000000 --- a/test/fixtures/transformation/es6-generators/completed-generator/exec.js +++ /dev/null @@ -1,11 +0,0 @@ -function *gen() { - return "ALL DONE"; -} - -var g = gen(); - -assert.deepEqual(g.next(), { - value: "ALL DONE", done: true -}); - -genHelpers.assertAlreadyFinished(g); diff --git a/test/fixtures/transformation/es6-generators/delegated-yield-should-be-governed-by-enclosing-try-statements/exec.js b/test/fixtures/transformation/es6-generators/delegated-yield-should-be-governed-by-enclosing-try-statements/exec.js deleted file mode 100644 index a4f36ea34b..0000000000 --- a/test/fixtures/transformation/es6-generators/delegated-yield-should-be-governed-by-enclosing-try-statements/exec.js +++ /dev/null @@ -1,27 +0,0 @@ -var error = new Error("thrown"); - -function *outer(n) { - try { - yield 0; - yield* inner(n); - yield 1; - } catch (err) { - yield err.message; - } - yield 4; -} - -function *inner(n) { - while (n --> 0) { - try { - if (n === 3) { - genHelpers.raise(error); - } - } finally { - yield n; - } - } -} - -genHelpers.check(outer(3), [0, 2, 1, 0, 1, 4]); -genHelpers.check(outer(5), [0, 4, 3, "thrown", 4]); diff --git a/test/fixtures/transformation/es6-generators/delegated-yield-should-cope-with-empty-delegatees/exec.js b/test/fixtures/transformation/es6-generators/delegated-yield-should-cope-with-empty-delegatees/exec.js deleted file mode 100644 index bf51aa9c8f..0000000000 --- a/test/fixtures/transformation/es6-generators/delegated-yield-should-cope-with-empty-delegatees/exec.js +++ /dev/null @@ -1,10 +0,0 @@ -function *gen(condition) { - if (condition) { - yield 0; - yield* gen(false); - yield 1; - } -} - -genHelpers.check(gen(true), [0, 1]); -genHelpers.check(gen(false), []); diff --git a/test/fixtures/transformation/es6-generators/delegated-yield-should-delegate-correctly/exec.js b/test/fixtures/transformation/es6-generators/delegated-yield-should-delegate-correctly/exec.js deleted file mode 100644 index 2db0a32fd5..0000000000 --- a/test/fixtures/transformation/es6-generators/delegated-yield-should-delegate-correctly/exec.js +++ /dev/null @@ -1,12 +0,0 @@ -function *gen(condition) { - yield 0; - if (condition) { - yield 1; - yield* gen(false); - yield 2; - } - yield 3; -} - -genHelpers.check(gen(true), [0, 1, 0, 3, 2, 3]); -genHelpers.check(gen(false), [0, 3]); diff --git a/test/fixtures/transformation/es6-generators/delegated-yield-should-dispatch-thrown-exceptions-correctly/exec.js b/test/fixtures/transformation/es6-generators/delegated-yield-should-dispatch-thrown-exceptions-correctly/exec.js deleted file mode 100644 index 1dff85c4ab..0000000000 --- a/test/fixtures/transformation/es6-generators/delegated-yield-should-dispatch-thrown-exceptions-correctly/exec.js +++ /dev/null @@ -1,37 +0,0 @@ -var count = 0; - -function *gen() { - yield* inner(); - try { - yield* inner(); - } catch (err) { - // pass - } - return yield* inner(); -} - -function *inner() { - return yield count++; -} - -var g = gen(); - -assert.deepEqual(g.next(), { - value: 0, - done: false -}); - -assert.deepEqual(g.next(), { - value: 1, - done: false -}); - -assert.deepEqual(g.throw(new Error("lol")), { - value: 2, - done: false, -}); - -assert.deepEqual(g.next("sent"), { - value: "sent", - done: true -}); diff --git a/test/fixtures/transformation/es6-generators/delegated-yield-should-pass-sent-values-through/exec.js b/test/fixtures/transformation/es6-generators/delegated-yield-should-pass-sent-values-through/exec.js deleted file mode 100644 index 1abc3a015a..0000000000 --- a/test/fixtures/transformation/es6-generators/delegated-yield-should-pass-sent-values-through/exec.js +++ /dev/null @@ -1,15 +0,0 @@ -function *outer(n) { - yield* inner(n << 1); - yield "zxcv"; -} - -function *inner(n) { - return yield yield yield n; -} - -var g = outer(3); -assert.deepEqual(g.next(), { value: 6, done: false }); -assert.deepEqual(g.next(1), { value: 1, done: false }); -assert.deepEqual(g.next(2), { value: 2, done: false }); -assert.deepEqual(g.next(4), { value: "zxcv", done: false }); -assert.deepEqual(g.next(5), { value: void 0, done: true }); diff --git a/test/fixtures/transformation/es6-generators/delegated-yield-should-support-deeper-nesting/exec.js b/test/fixtures/transformation/es6-generators/delegated-yield-should-support-deeper-nesting/exec.js deleted file mode 100644 index f3b8d0f438..0000000000 --- a/test/fixtures/transformation/es6-generators/delegated-yield-should-support-deeper-nesting/exec.js +++ /dev/null @@ -1,18 +0,0 @@ -function *outer(n) { - yield n; - yield* middle(n - 1, inner(n + 10)); - yield n + 1; -} - -function *middle(n, plusTen) { - yield n; - yield* inner(n - 1); - yield n + 1; - yield* plusTen; -} - -function *inner(n) { - yield n; -} - -genHelpers.check(outer(5), [5, 4, 3, 5, 15, 6]); diff --git a/test/fixtures/transformation/es6-generators/delegated-yieldshould-support-any-iterable-argument/exec.js b/test/fixtures/transformation/es6-generators/delegated-yieldshould-support-any-iterable-argument/exec.js deleted file mode 100644 index de52f46776..0000000000 --- a/test/fixtures/transformation/es6-generators/delegated-yieldshould-support-any-iterable-argument/exec.js +++ /dev/null @@ -1,11 +0,0 @@ -function *gen() { - yield 0; - yield* [ - yield "one", - yield "two", - yield "three" - ]; - yield 5; -} - -genHelpers.check(gen(), [0, "one", "two", "three", 2, 3, 4, 5]); diff --git a/test/fixtures/transformation/es6-generators/dynamic-exception-should-be-dispatched-correctly/exec.js b/test/fixtures/transformation/es6-generators/dynamic-exception-should-be-dispatched-correctly/exec.js deleted file mode 100644 index 27a64b3356..0000000000 --- a/test/fixtures/transformation/es6-generators/dynamic-exception-should-be-dispatched-correctly/exec.js +++ /dev/null @@ -1,20 +0,0 @@ -function *gen(x, fname) { - try { - return fns[fname](x); - } catch (thrown) { - yield thrown; - } - } - - var fns = { - f: function(x) { - throw x; - }, - - g: function(x) { - return x; - } - }; - - genHelpers.check(gen("asdf", "f"), ["asdf"]); - genHelpers.check(gen("asdf", "g"), [], "asdf"); diff --git a/test/fixtures/transformation/es6-generators/empty-while-loops-should-be-preserved-in-generated-code/exec.js b/test/fixtures/transformation/es6-generators/empty-while-loops-should-be-preserved-in-generated-code/exec.js deleted file mode 100644 index e762ed9881..0000000000 --- a/test/fixtures/transformation/es6-generators/empty-while-loops-should-be-preserved-in-generated-code/exec.js +++ /dev/null @@ -1,16 +0,0 @@ -function *gen(x) { - while (x) { - // empty while loop - } - - do { - // empty do-while loop - } while (x); - - return gen.toString(); -} - -var info = gen(false).next(); -assert.strictEqual(info.done, true); -assert.ok(/do \{/.test(info.value)); -assert.ok(/while \(/.test(info.value)); diff --git a/test/fixtures/transformation/es6-generators/for-in-loop-generator-should-handle-break-in-loop/exec.js b/test/fixtures/transformation/es6-generators/for-in-loop-generator-should-handle-break-in-loop/exec.js deleted file mode 100644 index e5a2225e7b..0000000000 --- a/test/fixtures/transformation/es6-generators/for-in-loop-generator-should-handle-break-in-loop/exec.js +++ /dev/null @@ -1,19 +0,0 @@ -function *gen(obj) { - var count = 0; - for (var key in (yield "why not", obj)) { - if (obj.hasOwnProperty(key)) { - if (key === "skip") { - break; - } - count += 1; - yield [key, obj[key]]; - } - } - return count; -} - -genHelpers.check( - gen({ a: 1, b: 2, skip: 3, c: 4 }), - ["why not", ["a", 1], ["b", 2]], - 2 -); diff --git a/test/fixtures/transformation/es6-generators/for-in-loop-generator-should-handle-property-deletion-in-loop/exec.js b/test/fixtures/transformation/es6-generators/for-in-loop-generator-should-handle-property-deletion-in-loop/exec.js deleted file mode 100644 index e0b9313bd7..0000000000 --- a/test/fixtures/transformation/es6-generators/for-in-loop-generator-should-handle-property-deletion-in-loop/exec.js +++ /dev/null @@ -1,13 +0,0 @@ -function *gen() { - var count = 0; - var obj = {foo: 1, bar: 2}; - for (var key in obj) { - assert(obj.hasOwnProperty(key), key + " must be own property"); - yield [key, obj[key]]; - delete obj.bar; - count += 1; - } - return count; -} - -genHelpers.check(gen(), [["foo", 1]], 1); diff --git a/test/fixtures/transformation/es6-generators/for-in-loop-generator-should-handle-risky-object-expressions/exec.js b/test/fixtures/transformation/es6-generators/for-in-loop-generator-should-handle-risky-object-expressions/exec.js deleted file mode 100644 index 9fa63ef689..0000000000 --- a/test/fixtures/transformation/es6-generators/for-in-loop-generator-should-handle-risky-object-expressions/exec.js +++ /dev/null @@ -1,26 +0,0 @@ -function a(sent) { - assert.strictEqual(sent, 1); - a.called = true; -} - -function b(sent) { - assert.strictEqual(sent, 2); - b.called = true; - return { callee: b }; -} - -function *gen() { - assert.ok(!a.called); - assert.ok(!b.called); - for (var key in a(yield 0), b(yield 1)) { - assert.ok(a.called); - assert.ok(b.called); - assert.strictEqual(yield key, 3); - } - - for (var key in a(1), { foo: "foo", bar: "bar" }) { - yield key; - } -} - -genHelpers.check(gen(), [0, 1, "callee", "foo", "bar"]); diff --git a/test/fixtures/transformation/es6-generators/for-in-loop-generator-should-handle-the-simple-case/exec.js b/test/fixtures/transformation/es6-generators/for-in-loop-generator-should-handle-the-simple-case/exec.js deleted file mode 100644 index 740041c23f..0000000000 --- a/test/fixtures/transformation/es6-generators/for-in-loop-generator-should-handle-the-simple-case/exec.js +++ /dev/null @@ -1,12 +0,0 @@ -function *gen() { - var count = 0; - var obj = {foo: 1, bar: 2}; - for (var key in obj) { - assert(obj.hasOwnProperty(key), key + " must be own property"); - yield [key, obj[key]]; - count += 1; - } - return count; -} - -genHelpers.check(gen(), [["foo", 1], ["bar", 2]], 2); diff --git a/test/fixtures/transformation/es6-generators/for-in-loop-generator-should-loop-over-inherited-properties/exec.js b/test/fixtures/transformation/es6-generators/for-in-loop-generator-should-loop-over-inherited-properties/exec.js deleted file mode 100644 index 1248131d9b..0000000000 --- a/test/fixtures/transformation/es6-generators/for-in-loop-generator-should-loop-over-inherited-properties/exec.js +++ /dev/null @@ -1,16 +0,0 @@ -function *gen() { - var count = 0; - function Foo() { - this.baz = 1 - } - Foo.prototype.bar = 2; - - var foo = new Foo(); - for (var key in foo) { - yield [key, foo[key]]; - count += 1; - } - return count; -} - -genHelpers.check(gen(), [["baz", 1], ["bar", 2]], 2); diff --git a/test/fixtures/transformation/es6-generators/for-loop-with-var-decl-and-no-update-expression-should-compile-and-run/exec.js b/test/fixtures/transformation/es6-generators/for-loop-with-var-decl-and-no-update-expression-should-compile-and-run/exec.js deleted file mode 100644 index 933b61aa3c..0000000000 --- a/test/fixtures/transformation/es6-generators/for-loop-with-var-decl-and-no-update-expression-should-compile-and-run/exec.js +++ /dev/null @@ -1,7 +0,0 @@ -// https://github.com/facebook/regenerator/issues/103 -function *range() { - for (var i = 0; false; ) { - } -} - -genHelpers.check(range(), []); diff --git a/test/fixtures/transformation/es6-generators/for-of-loops-should-work-for-Arrays/exec.js b/test/fixtures/transformation/es6-generators/for-of-loops-should-work-for-Arrays/exec.js deleted file mode 100644 index 30b287a0b1..0000000000 --- a/test/fixtures/transformation/es6-generators/for-of-loops-should-work-for-Arrays/exec.js +++ /dev/null @@ -1,5 +0,0 @@ -var sum = 0; -for (var x of [1, 2].concat(3)) { - sum += x; -} -assert.strictEqual(sum, 6); diff --git a/test/fixtures/transformation/es6-generators/for-of-loops-should-work-for-generators/exec.js b/test/fixtures/transformation/es6-generators/for-of-loops-should-work-for-generators/exec.js deleted file mode 100644 index 667e1b67bf..0000000000 --- a/test/fixtures/transformation/es6-generators/for-of-loops-should-work-for-generators/exec.js +++ /dev/null @@ -1,10 +0,0 @@ -function *range(n) { - for (var i = 0; i < n; ++i) { - yield i; - } -} - -var value, values = []; -for (value of range(3)) - values.push(value); -assert.deepEqual(values, [0, 1, 2]); diff --git a/test/fixtures/transformation/es6-generators/for-of-loops-should-work-inside-of-generators/exec.js b/test/fixtures/transformation/es6-generators/for-of-loops-should-work-inside-of-generators/exec.js deleted file mode 100644 index fda5afe451..0000000000 --- a/test/fixtures/transformation/es6-generators/for-of-loops-should-work-inside-of-generators/exec.js +++ /dev/null @@ -1,45 +0,0 @@ -function *yieldPermutations(list) { - if (list.length < 2) { - yield list; - return 1; - } - - var count = 0; - var first = list.slice(0, 1); - var genRest = yieldPermutations(list.slice(1)); - - for (var perm of genRest) { - for (var i = 0; i < list.length; ++i) { - var prefix = perm.slice(0, i); - var suffix = perm.slice(i); - yield prefix.concat(first, suffix); - } - - count += i; - } - - return count; -} - -var count = 0; -for (var perm of yieldPermutations([])) { - assert.deepEqual(perm, []); - ++count; -} -assert.strictEqual(count, 1); - -genHelpers.check(yieldPermutations([1]), [[1]], 1); - -genHelpers.check(yieldPermutations([2, 1]), [ - [2, 1], - [1, 2] -], 2); - -genHelpers.check(yieldPermutations([1,3,2]), [ - [1, 3, 2], - [3, 1, 2], - [3, 2, 1], - [1, 2, 3], - [2, 1, 3], - [2, 3, 1] -], 6); diff --git a/test/fixtures/transformation/es6-generators/function-declaration-hoisting-should-work-even-if-the-declarations-are-out-of-order/exec.js b/test/fixtures/transformation/es6-generators/function-declaration-hoisting-should-work-even-if-the-declarations-are-out-of-order/exec.js deleted file mode 100644 index 1b1de7c33b..0000000000 --- a/test/fixtures/transformation/es6-generators/function-declaration-hoisting-should-work-even-if-the-declarations-are-out-of-order/exec.js +++ /dev/null @@ -1,24 +0,0 @@ -function *gen(n) { - yield increment(n); - - function increment(x) { - return x + 1; - } - - if (n % 2) { - yield halve(decrement(n)); - - function halve(x) { - return x >> 1; - } - - function decrement(x) { - return x - 1; - } - } - - yield increment(increment(n)); -} - -genHelpers.check(gen(3), [4, 1, 5]); -genHelpers.check(gen(4), [5, 6]); diff --git a/test/fixtures/transformation/es6-generators/function-declaration-hoisting-should-work-for-nested-generator-function-declarations/exec.js b/test/fixtures/transformation/es6-generators/function-declaration-hoisting-should-work-for-nested-generator-function-declarations/exec.js deleted file mode 100644 index 62337159e3..0000000000 --- a/test/fixtures/transformation/es6-generators/function-declaration-hoisting-should-work-for-nested-generator-function-declarations/exec.js +++ /dev/null @@ -1,15 +0,0 @@ -function *outer(n) { - yield 0; - assert.ok(regeneratorRuntime.isGeneratorFunction(inner)); - return yield* inner(n); - - // Note that this function declaration comes after everything else - // in the outer function, but needs to be fully available above. - function *inner(n) { - yield n - 1; - yield n; - return yield n + 1; - } -} - -genHelpers.check(outer(2), [0, 1, 2, 3], 4); diff --git a/test/fixtures/transformation/es6-generators/generator-function-expression-should-behave-just-like-a-declared-generator/exec.js b/test/fixtures/transformation/es6-generators/generator-function-expression-should-behave-just-like-a-declared-generator/exec.js deleted file mode 100644 index 6dd8796cb4..0000000000 --- a/test/fixtures/transformation/es6-generators/generator-function-expression-should-behave-just-like-a-declared-generator/exec.js +++ /dev/null @@ -1,6 +0,0 @@ -genHelpers.check(function *(x, y) { - yield x; - yield y; - yield x + y; - return x * y; -}(3, 7), [3, 7, 10], 21); diff --git a/test/fixtures/transformation/es6-generators/generator-function-prototype-should-follow-the-expected-object-model/exec.js b/test/fixtures/transformation/es6-generators/generator-function-prototype-should-follow-the-expected-object-model/exec.js deleted file mode 100644 index db35e057a7..0000000000 --- a/test/fixtures/transformation/es6-generators/generator-function-prototype-should-follow-the-expected-object-model/exec.js +++ /dev/null @@ -1,60 +0,0 @@ - -var GeneratorFunctionPrototype = f.__proto__; -var GeneratorFunction = GeneratorFunctionPrototype.constructor; - -assert.strictEqual(GeneratorFunction.name, 'GeneratorFunction'); -assert.strictEqual(GeneratorFunction.prototype, - GeneratorFunctionPrototype); -assert.strictEqual(GeneratorFunctionPrototype.prototype.constructor, - GeneratorFunctionPrototype); -assert.strictEqual(GeneratorFunctionPrototype.prototype, - f.prototype.__proto__); -assert.strictEqual(GeneratorFunctionPrototype.__proto__, - Function.prototype); -assert.strictEqual(GeneratorFunctionPrototype.name, - "GeneratorFunctionPrototype"); - -assert.strictEqual(typeof f2, "function"); -assert.strictEqual(f2.constructor, GeneratorFunction); -assert.ok(f2 instanceof GeneratorFunction); -assert.strictEqual(f2.name, "f2"); - -var g = f(); -assert.ok(g instanceof f); -assert.strictEqual(g.__proto__, f.prototype); - -assert.deepEqual([], Object.getOwnPropertyNames(f.prototype)); -// assert.deepEqual([], Object.getOwnPropertyNames(g)); - -f.prototype.x = 42; - -var g2 = f(); -assert.strictEqual(g2.x, 42); - -var g3 = new f(); -assert.strictEqual(g3.x, 42); - -function* f2() { - yield 1; -} - -assert.strictEqual(f.__proto__, f2.__proto__); -assert.strictEqual(f.hasOwnProperty('constructor'), false); -assert.strictEqual(f.__proto__.constructor.name, 'GeneratorFunction'); - -// Intentionally at the end to test hoisting. -function* f() { - yield this; -} - -function* f() { - yield 1; -} - -var f2 = f; -f = 42; -var g = f2(); - -assert.deepEqual(g.next(), { value: 1, done: false }); -assert.deepEqual(g.next(), { value: void 0, done: true }); -assert.ok(g instanceof f2); diff --git a/test/fixtures/transformation/es6-generators/generator-reentry-attempt-should-complain-with-a-TypeError/exec.js b/test/fixtures/transformation/es6-generators/generator-reentry-attempt-should-complain-with-a-TypeError/exec.js deleted file mode 100644 index ce41e9851e..0000000000 --- a/test/fixtures/transformation/es6-generators/generator-reentry-attempt-should-complain-with-a-TypeError/exec.js +++ /dev/null @@ -1,18 +0,0 @@ -function *gen(x) { - try { - (yield x).next(x); - } catch (err) { - yield err; - } - return x + 1; -} - -var g = gen(3); -assert.deepEqual(g.next(), { value: 3, done: false }); -var complaint = g.next(g); // Sending the generator to itself. -assert.ok(complaint.value instanceof Error); -assert.strictEqual( - complaint.value.message, - "Generator is already running" -); -assert.deepEqual(g.next(), { value: 4, done: true }); diff --git a/test/fixtures/transformation/es6-generators/generator-return-method-should-behave-as-if-generator-actually-returned/exec.js b/test/fixtures/transformation/es6-generators/generator-return-method-should-behave-as-if-generator-actually-returned/exec.js deleted file mode 100644 index 089deed534..0000000000 --- a/test/fixtures/transformation/es6-generators/generator-return-method-should-behave-as-if-generator-actually-returned/exec.js +++ /dev/null @@ -1,22 +0,0 @@ -var executedFinally = false; - -function *gen() { - try { - yield 0; - } catch (err) { - assert.ok(false, "should not have executed the catch handler"); - } finally { - executedFinally = true; - } -} - -var g = gen(); -assert.deepEqual(g.next(), { value: 0, done: false }); - -assert.deepEqual(g.return("argument"), { - value: "argument", - done: true -}); - -assert.strictEqual(executedFinally, true); -genHelpers.assertAlreadyFinished(g); diff --git a/test/fixtures/transformation/es6-generators/generator-return-method-should-work-with-newborn-generators/exec.js b/test/fixtures/transformation/es6-generators/generator-return-method-should-work-with-newborn-generators/exec.js deleted file mode 100644 index 84f60dbf8f..0000000000 --- a/test/fixtures/transformation/es6-generators/generator-return-method-should-work-with-newborn-generators/exec.js +++ /dev/null @@ -1,12 +0,0 @@ -function *gen() { - yield 0; -} - -var g = gen(); - -assert.deepEqual(g.return("argument"), { - value: "argument", - done: true -}); - -genHelpers.assertAlreadyFinished(g); diff --git a/test/fixtures/transformation/es6-generators/generator-throw-method-should-complete-generator/exec.js b/test/fixtures/transformation/es6-generators/generator-throw-method-should-complete-generator/exec.js deleted file mode 100644 index c41c82c2dd..0000000000 --- a/test/fixtures/transformation/es6-generators/generator-throw-method-should-complete-generator/exec.js +++ /dev/null @@ -1,16 +0,0 @@ -function *gen(x) { - yield 2; - throw 1; -} - -var u = gen(); - -u.next(); - -try { - u.throw(2); -} catch (err) { - assert.strictEqual(err, 2); -} - -genHelpers.assertAlreadyFinished(u); diff --git a/test/fixtures/transformation/es6-generators/generator-throw-method-should-immediately-complete-a-new-born-generator/exec.js b/test/fixtures/transformation/es6-generators/generator-throw-method-should-immediately-complete-a-new-born-generator/exec.js deleted file mode 100644 index 175435b562..0000000000 --- a/test/fixtures/transformation/es6-generators/generator-throw-method-should-immediately-complete-a-new-born-generator/exec.js +++ /dev/null @@ -1,16 +0,0 @@ -var began = false; - -function *gen() { - began = true; - yield 1; -} - -var g = gen(); -var exception = new Error("unhandled exception"); -try { - g.throw(exception); - assert.ok(false, "should have thrown an exception"); -} catch (err) { - assert.strictEqual(err, exception); - assert.strictEqual(began, false); -} diff --git a/test/fixtures/transformation/es6-generators/generator-throw-method-should-not-propagate-errors-handled-inside-a-delegate/exec.js b/test/fixtures/transformation/es6-generators/generator-throw-method-should-not-propagate-errors-handled-inside-a-delegate/exec.js deleted file mode 100644 index dcdce48792..0000000000 --- a/test/fixtures/transformation/es6-generators/generator-throw-method-should-not-propagate-errors-handled-inside-a-delegate/exec.js +++ /dev/null @@ -1,20 +0,0 @@ -function *outer() { - try { - yield* inner(); - } catch (err) { - return -1; - } - return 1; -} - -function *inner() { - try { - yield void 0; - } catch (e) { - return; - } -} - -var g = outer(); -g.next(); -assert.equal(g.throw(new Error('foo')).value, 1); diff --git a/test/fixtures/transformation/es6-generators/generator-throw-method-should-propagate-errors-unhandled-inside-a-delegate/exec.js b/test/fixtures/transformation/es6-generators/generator-throw-method-should-propagate-errors-unhandled-inside-a-delegate/exec.js deleted file mode 100644 index 295a4c8aeb..0000000000 --- a/test/fixtures/transformation/es6-generators/generator-throw-method-should-propagate-errors-unhandled-inside-a-delegate/exec.js +++ /dev/null @@ -1,16 +0,0 @@ -function *outer() { - try { - yield* inner(); - } catch (err) { - return -1; - } - return 1; -} - -function *inner() { - yield void 0; -} - -var g = outer(); -g.next(); -assert.equal(g.throw(new Error('foo')).value, -1); diff --git a/test/fixtures/transformation/es6-generators/generator-throw-method-should-work-after-the-final-call-to-next/exec.js b/test/fixtures/transformation/es6-generators/generator-throw-method-should-work-after-the-final-call-to-next/exec.js deleted file mode 100644 index 7017683f5e..0000000000 --- a/test/fixtures/transformation/es6-generators/generator-throw-method-should-work-after-the-final-call-to-next/exec.js +++ /dev/null @@ -1,14 +0,0 @@ -function *gen() { - yield 1; -} - -var g = gen(); -assert.deepEqual(g.next(), { value: 1, done: false }); - -var exception = new Error("unhandled exception"); -try { - g.throw(exception); - assert.ok(false, "should have thrown an exception"); -} catch (err) { - assert.strictEqual(err, exception); -} diff --git a/test/fixtures/transformation/es6-generators/infinite-sequence-generator/exec.js b/test/fixtures/transformation/es6-generators/infinite-sequence-generator/exec.js deleted file mode 100644 index 7c74586b83..0000000000 --- a/test/fixtures/transformation/es6-generators/infinite-sequence-generator/exec.js +++ /dev/null @@ -1,41 +0,0 @@ -function *gen(start, step) { - step = step || 1; - while (true) { - yield start; - start += step; - } -} - -function *limit(g, stop) { - while (true) { - var info = g.next(); - if (info.done) { - return; - } else if (info.value < stop) { - yield info.value; - } else { - return; - } - } -} - -// should generate a lot of plausible values -var g = gen(10, 2); - -assert.deepEqual(g.next(), { value: 10, done: false }); -assert.deepEqual(g.next(), { value: 12, done: false }); -assert.deepEqual(g.next(), { value: 14, done: false }); -assert.deepEqual(g.next(), { value: 16, done: false }); - -var sum = 10 + 12 + 14 + 16; - -for (var n = 0; n < 1000; ++n) { - var info = g.next(); - sum += info.value; - assert.strictEqual(info.done, false); -} - -assert.strictEqual(sum, 1017052); - -// should allow limiting -genHelpers.check(limit(gen(10, 3), 20), [10, 13, 16, 19]); diff --git a/test/fixtures/transformation/es6-generators/isGeneratorFunction-should-work-for-function-declarations/exec.js b/test/fixtures/transformation/es6-generators/isGeneratorFunction-should-work-for-function-declarations/exec.js deleted file mode 100644 index daebbf16da..0000000000 --- a/test/fixtures/transformation/es6-generators/isGeneratorFunction-should-work-for-function-declarations/exec.js +++ /dev/null @@ -1,19 +0,0 @@ -// Do the assertions up here to make sure the generator function is -// marked at the beginning of the block the function is declared in. -assert.strictEqual( - regeneratorRuntime.isGeneratorFunction(genFun), - true -); - -assert.strictEqual( - regeneratorRuntime.isGeneratorFunction(normalFun), - false -); - -function normalFun() { - return 0; -} - -function *genFun() { - yield 0; -} diff --git a/test/fixtures/transformation/es6-generators/isGeneratorFunction-should-work-for-function-expressions/exec.js b/test/fixtures/transformation/es6-generators/isGeneratorFunction-should-work-for-function-expressions/exec.js deleted file mode 100644 index a7649e0737..0000000000 --- a/test/fixtures/transformation/es6-generators/isGeneratorFunction-should-work-for-function-expressions/exec.js +++ /dev/null @@ -1,13 +0,0 @@ -assert.strictEqual( - regeneratorRuntime.isGeneratorFunction(function *genFun() { - yield 0; - }), - true -); - -assert.strictEqual( - regeneratorRuntime.isGeneratorFunction(function normalFun() { - return 0; - }), - false -); diff --git a/test/fixtures/transformation/es6-generators/labeled-break-and-continue-statements-should-be-able-to-exit-multiple-try-statements/exec.js b/test/fixtures/transformation/es6-generators/labeled-break-and-continue-statements-should-be-able-to-exit-multiple-try-statements/exec.js deleted file mode 100644 index 3bf4008ebe..0000000000 --- a/test/fixtures/transformation/es6-generators/labeled-break-and-continue-statements-should-be-able-to-exit-multiple-try-statements/exec.js +++ /dev/null @@ -1,82 +0,0 @@ - - var e1 = "first"; - var e2 = "second"; - var e3 = "third"; - var e4 = "fourth"; - - function *gen(n, which) { - try { - yield 0; - genHelpers.raise(e1); - - } finally { - yield 1; - - loop: - for (var i = 0; i < n; ++i) { - yield i; - - try { - genHelpers.raise(e2); - } finally { - yield 2; - - try { - genHelpers.raise(e3); - } finally { - yield 3; - - try { - genHelpers.raise(e4); - } finally { - yield 4; - - if (which === "break") { - yield "breaking"; - break loop; - } - - if (which === "continue") { - yield "continuing"; - continue loop; - } - - yield 5; - } - } - } - } - - yield 6; - } - } - - try { - genHelpers.check(gen(1, "break"), [ - 0, 1, 0, 2, 3, 4, "breaking", 6 - ]); - assert.ok(false, "should have thrown an exception"); - } catch (err) { - assert.strictEqual(err, e1); - } - - try { - genHelpers.check(gen(3, "continue"), [ - 0, 1, 0, 2, 3, 4, "continuing", - 1, 2, 3, 4, "continuing", - 2, 2, 3, 4, "continuing", - 6 // Loop finished naturally. - ]); - assert.ok(false, "should have thrown an exception"); - } catch (err) { - assert.strictEqual(err, e1); - } - - try { - genHelpers.check(gen(3, "neither"), [ - 0, 1, 0, 2, 3, 4, 5 - ]); - assert.ok(false, "should have thrown an exception"); - } catch (err) { - assert.strictEqual(err, e4); - } diff --git a/test/fixtures/transformation/es6-generators/nested-finally-blocks/exec.js b/test/fixtures/transformation/es6-generators/nested-finally-blocks/exec.js deleted file mode 100644 index 1bcdee5b49..0000000000 --- a/test/fixtures/transformation/es6-generators/nested-finally-blocks/exec.js +++ /dev/null @@ -1,41 +0,0 @@ -function *usingThrow() { - try { - try { - try { - throw "thrown"; - } finally { - yield 1; - } - } catch (thrown) { - yield thrown; - } finally { - yield 2; - } - } finally { - yield 3; - } -} - -function *usingRaise() { - try { - try { - try { - genHelpers.raise("thrown"); - } finally { - yield 1; - } - } catch (thrown) { - yield thrown; - } finally { - yield 2; - } - } finally { - yield 3; - } -} - -// should statically execute in order -genHelpers.check(usingThrow(), [1, "thrown", 2, 3]); - -// should dynamically execute in order -genHelpers.check(usingRaise(), [1, "thrown", 2, 3]); diff --git a/test/fixtures/transformation/es6-generators/nested-generators-in-try-catch-should-get-a-reference-to-the-caught-error/exec.js b/test/fixtures/transformation/es6-generators/nested-generators-in-try-catch-should-get-a-reference-to-the-caught-error/exec.js deleted file mode 100644 index f585b20cba..0000000000 --- a/test/fixtures/transformation/es6-generators/nested-generators-in-try-catch-should-get-a-reference-to-the-caught-error/exec.js +++ /dev/null @@ -1,18 +0,0 @@ -function *gen() { - try { - nonExistent; - } catch (e) { - yield function* () { - yield e; - } - } -} - -var genFun2 = gen().next().value; -assert.ok(regeneratorRuntime.isGeneratorFunction(genFun2)); -var gen2 = genFun2(); -var res = gen2.next(); -assert.ok(res.value instanceof ReferenceError); -// Note that we don't do strict equality over the message because it varies -// across browsers (if we ever want to run tests in browsers). -assert.ok(res.value.message.match(/nonExistent/)); diff --git a/test/fixtures/transformation/es6-generators/new-expressions-should-be-able-to-contain-yield-sub-expressions/exec.js b/test/fixtures/transformation/es6-generators/new-expressions-should-be-able-to-contain-yield-sub-expressions/exec.js deleted file mode 100644 index 6435d69531..0000000000 --- a/test/fixtures/transformation/es6-generators/new-expressions-should-be-able-to-contain-yield-sub-expressions/exec.js +++ /dev/null @@ -1,22 +0,0 @@ -function A(first, second) { - this.first = first; - this.second = second; -} - -function *gen() { - return yield new (yield 0)(yield 1, yield 2); -} - -var g = gen(); - -assert.deepEqual(g.next(), { value: 0, done: false }); -assert.deepEqual(g.next(A), { value: 1, done: false }); -assert.deepEqual(g.next("asdf"), { value: 2, done: false }); - -var info = g.next("zxcv"); -assert.strictEqual(info.done, false); -assert.ok(info.value instanceof A); -assert.strictEqual(info.value.first, "asdf"); -assert.strictEqual(info.value.second, "zxcv"); - -assert.deepEqual(g.next("qwer"), { value: "qwer", done: true }); diff --git a/test/fixtures/transformation/es6-generators/newborn-generators-should-allow-chaining-newborn-and-non-newborn-generators/exec.js b/test/fixtures/transformation/es6-generators/newborn-generators-should-allow-chaining-newborn-and-non-newborn-generators/exec.js deleted file mode 100644 index 630120638b..0000000000 --- a/test/fixtures/transformation/es6-generators/newborn-generators-should-allow-chaining-newborn-and-non-newborn-generators/exec.js +++ /dev/null @@ -1,40 +0,0 @@ -function *range(n) { - for (var i = 0; i < n; ++i) { - yield i; - } -} - -function *chain(a, b) { - yield* a; - yield* b; -} - -genHelpers.check(chain(range(3), range(5)), [0, 1, 2, 0, 1, 2, 3, 4]); - -function *y3(x) { - return yield yield yield x; -} - -function *y5(x) { - return yield yield yield yield yield x; -} - -genHelpers.check( - chain(y3("foo"), y5("bar")), - ["foo", 1, 2, "bar", 4, 5, 6, 7] -); - -var g3 = y3("three"); -assert.deepEqual(g3.next(), { - value: "three", - done: false -}); - -var g5 = y5("five"); -assert.deepEqual(g5.next(), { - value: "five", - done: false -}); - -var undef; // A little easier to read than void 0. -genHelpers.check(chain(g3, g5), [undef, 1, undef, 3, 4, 5]); diff --git a/test/fixtures/transformation/es6-generators/newborn-generators-should-be-able-to-yield-star-non-newborn-generators/exec.js b/test/fixtures/transformation/es6-generators/newborn-generators-should-be-able-to-yield-star-non-newborn-generators/exec.js deleted file mode 100644 index 9d8d186519..0000000000 --- a/test/fixtures/transformation/es6-generators/newborn-generators-should-be-able-to-yield-star-non-newborn-generators/exec.js +++ /dev/null @@ -1,29 +0,0 @@ -function *inner() { - return [yield 1, yield 2]; -} - -function *outer(delegate) { - return yield* delegate; -} - -var n = inner(); - -assert.deepEqual(n.next(), { - value: 1, - done: false -}); - -var g = outer(n); - -// I would really like to be able to pass 3 to g.next here, but V8 -// ignores values sent to newborn generators, and SpiderMonkey throws -// a TypeError. -assert.deepEqual(g.next(), { - value: 2, - done: false -}); - -assert.deepEqual(g.next(4), { - value: [void 0, 4], - done: true -}); diff --git a/test/fixtures/transformation/es6-generators/newborn-generators-should-support-the-ignore-initial-yield-wrapper-idiom/exec.js b/test/fixtures/transformation/es6-generators/newborn-generators-should-support-the-ignore-initial-yield-wrapper-idiom/exec.js deleted file mode 100644 index 2eb492c895..0000000000 --- a/test/fixtures/transformation/es6-generators/newborn-generators-should-support-the-ignore-initial-yield-wrapper-idiom/exec.js +++ /dev/null @@ -1,58 +0,0 @@ -var markers = []; - -function *inner() { - markers.push(0); - var sent1 = yield 1; - markers.push(2); - var sent2 = yield 2; - markers.push(3); - return [sent1, sent2]; -} - -function wrapper(delegate) { - var gen = (function*() { - // This yield is the "initial yield" whose argument we ignore. - var sent = yield "ignored", info; - - markers.push(1); - - while (!(info = delegate.next(sent)).done) { - sent = yield info.value; - } - - markers.push(4); - - return info.value; - })(); - - // Ensure that gen is not newborn and that the next invocation of - // gen.next(value) can send value to the initial yield expression. - gen.next(); - - return gen; -} - -var n = inner(); - -assert.deepEqual(n.next(), { - value: 1, - done: false -}); - -var g = wrapper(n); - -// Unlike in the previous spec, it's fine to pass 3 to g.next here, -// because g is not newborn, because g.next was already called once -// before g was returned from the wrapper function. -assert.deepEqual(g.next(3), { - value: 2, - done: false -}); - -assert.deepEqual(g.next(4), { - value: [3, 4], - done: true -}); - -// Ensure we encountered the marker points in the expected order. -assert.deepEqual(markers, [0, 1, 2, 3, 4]); diff --git a/test/fixtures/transformation/es6-generators/object-literal-generator-should-yield-the-correct-object/exec.js b/test/fixtures/transformation/es6-generators/object-literal-generator-should-yield-the-correct-object/exec.js deleted file mode 100644 index a45a519ba8..0000000000 --- a/test/fixtures/transformation/es6-generators/object-literal-generator-should-yield-the-correct-object/exec.js +++ /dev/null @@ -1,9 +0,0 @@ -function *gen(a, b) { - yield { - a: a - (yield a), - b: yield b - }; -} - -genHelpers.check(gen(1, 2), [1, 2, { a: 0, b: 2 }]); -genHelpers.check(gen(4, 2), [4, 2, { a: 3, b: 2 }]); diff --git a/test/fixtures/transformation/es6-generators/object-literals-with-multiple-yields-should-receive-different-sent-values/exec.js b/test/fixtures/transformation/es6-generators/object-literals-with-multiple-yields-should-receive-different-sent-values/exec.js deleted file mode 100644 index e18ec96410..0000000000 --- a/test/fixtures/transformation/es6-generators/object-literals-with-multiple-yields-should-receive-different-sent-values/exec.js +++ /dev/null @@ -1,17 +0,0 @@ -function *gen(fn) { - return { - a: yield "a", - b: yield "b", - c: fn(yield "c", yield "d"), - d: [yield "e", yield "f"] - }; -} - -genHelpers.check(gen(function sum(x, y) { - return x + y; -}), ["a", "b", "c", "d", "e", "f"], { - a: 1, - b: 2, - c: 3 + 4, - d: [5, 6] -}); diff --git a/test/fixtures/transformation/es6-generators/range-generator/exec.js b/test/fixtures/transformation/es6-generators/range-generator/exec.js deleted file mode 100644 index eef007c261..0000000000 --- a/test/fixtures/transformation/es6-generators/range-generator/exec.js +++ /dev/null @@ -1,9 +0,0 @@ -function *range(n) { - for (var i = 0; i < n; ++i) { - yield i; - } -} - -genHelpers.check(range(0), []); - -genHelpers.check(range(5), [0, 1, 2, 3, 4]); diff --git a/test/fixtures/transformation/es6-generators/should-support-multiple-yields-in-expression/exec.js b/test/fixtures/transformation/es6-generators/should-support-multiple-yields-in-expression/exec.js deleted file mode 100644 index 07ea21e280..0000000000 --- a/test/fixtures/transformation/es6-generators/should-support-multiple-yields-in-expression/exec.js +++ /dev/null @@ -1,5 +0,0 @@ -function *gen() { return (yield 0) + (yield 0); } -var itr = gen(); -itr.next(); -itr.next(1); -assert.equal(itr.next(2).value, 3); diff --git a/test/fixtures/transformation/es6-generators/should-yield-only-its-first-argument/exec.js b/test/fixtures/transformation/es6-generators/should-yield-only-its-first-argument/exec.js deleted file mode 100644 index d872a6c160..0000000000 --- a/test/fixtures/transformation/es6-generators/should-yield-only-its-first-argument/exec.js +++ /dev/null @@ -1,6 +0,0 @@ -function *gen(x) { - yield x; -} - -genHelpers.check(gen("oyez"), ["oyez"]); -genHelpers.check(gen("foo", "bar"), ["foo"]); diff --git a/test/fixtures/transformation/es6-generators/switch-statement-generator-should-jump-to-the-correct-cases/exec.js b/test/fixtures/transformation/es6-generators/switch-statement-generator-should-jump-to-the-correct-cases/exec.js deleted file mode 100644 index f506e3dc92..0000000000 --- a/test/fixtures/transformation/es6-generators/switch-statement-generator-should-jump-to-the-correct-cases/exec.js +++ /dev/null @@ -1,11 +0,0 @@ -function *gen(a) { - switch (yield a) { - case (yield "x") - a: - return "first case"; - case (yield "y") - a: - return "second case"; - } -} - -genHelpers.check(gen(1), [1, "x"], "first case"); -genHelpers.check(gen(2), [2, "x", "y"], "second case"); diff --git a/test/fixtures/transformation/es6-generators/the-arguments-object-should-not-get-confused-by-properties/exec.js b/test/fixtures/transformation/es6-generators/the-arguments-object-should-not-get-confused-by-properties/exec.js deleted file mode 100644 index 0193713567..0000000000 --- a/test/fixtures/transformation/es6-generators/the-arguments-object-should-not-get-confused-by-properties/exec.js +++ /dev/null @@ -1,7 +0,0 @@ -function *gen(obj) { - yield obj.arguments; - obj.arguments = "oyez"; - yield obj; -} - -genHelpers.check(gen({ arguments: 42 }), [42, { arguments: "oyez" }]); diff --git a/test/fixtures/transformation/es6-generators/the-arguments-object-should-work-in-simple-variadic-functions/exec.js b/test/fixtures/transformation/es6-generators/the-arguments-object-should-work-in-simple-variadic-functions/exec.js deleted file mode 100644 index 2082baecd9..0000000000 --- a/test/fixtures/transformation/es6-generators/the-arguments-object-should-work-in-simple-variadic-functions/exec.js +++ /dev/null @@ -1,12 +0,0 @@ -function *sum() { - var result = 0; - - for (var i = 0; i < arguments.length; ++i) { - yield result += arguments[i]; - } - - return result; -} - -genHelpers.check(sum(1, 2, 3), [1, 3, 6], 6); -genHelpers.check(sum(9, -5, 3, 0, 2), [9, 4, 7, 7, 9], 9); diff --git a/test/fixtures/transformation/es6-generators/throw-should-complete-generator/exec.js b/test/fixtures/transformation/es6-generators/throw-should-complete-generator/exec.js deleted file mode 100644 index aeba49f47d..0000000000 --- a/test/fixtures/transformation/es6-generators/throw-should-complete-generator/exec.js +++ /dev/null @@ -1,13 +0,0 @@ -function *gen(x) { - throw 1; -} - -var u = gen(); - -try { - u.next(); -} catch (err) { - assert.strictEqual(err, 1); -} - -genHelpers.assertAlreadyFinished(u); diff --git a/test/fixtures/transformation/es6-generators/try-catch-finally-generator/exec.js b/test/fixtures/transformation/es6-generators/try-catch-finally-generator/exec.js deleted file mode 100644 index 5c25e461bd..0000000000 --- a/test/fixtures/transformation/es6-generators/try-catch-finally-generator/exec.js +++ /dev/null @@ -1,42 +0,0 @@ - - function *usingThrow() { - yield 0; - try { - try { - yield 1; - throw 2; - yield 3; - } catch (x) { - throw yield x; - } finally { - yield 5; - } - } catch (thrown) { - yield thrown; - } - yield 6; - } - - function *usingRaise() { - yield 0; - try { - try { - yield 1; - genHelpers.raise(2); - yield 3; - } catch (x) { - throw yield x; - } finally { - yield 5; - } - } catch (thrown) { - yield thrown; - } - yield 6; - } - - // should statically catch and then finalize - genHelpers.check(usingThrow(), [0, 1, 2, 5, 3, 6]); - - // should dynamically catch and then finalize - genHelpers.check(usingRaise(), [0, 1, 2, 5, 3, 6]); diff --git a/test/fixtures/transformation/es6-generators/try-catch-generator/exec.js b/test/fixtures/transformation/es6-generators/try-catch-generator/exec.js deleted file mode 100644 index 67ce947eab..0000000000 --- a/test/fixtures/transformation/es6-generators/try-catch-generator/exec.js +++ /dev/null @@ -1,33 +0,0 @@ -function *usingThrow(x) { - yield 0; - try { - yield 1; - if (x % 2 === 0) - throw 2; - yield x; - } catch (x) { - yield x; - } - yield 3; -} - -function *usingRaise(x) { - yield 0; - try { - yield 1; - if (x % 2 === 0) - genHelpers.raise(2); - yield x; - } catch (x) { - yield x; - } - yield 3; -} - -// should catch static exceptions properly -genHelpers.check(usingThrow(4), [0, 1, 2, 3]); -genHelpers.check(usingThrow(5), [0, 1, 5, 3]); - -// should catch dynamic exceptions properly -genHelpers.check(usingRaise(4), [0, 1, 2, 3]); -genHelpers.check(usingRaise(5), [0, 1, 5, 3]); diff --git a/test/fixtures/transformation/es6-generators/try-finally-generator/exec.js b/test/fixtures/transformation/es6-generators/try-finally-generator/exec.js deleted file mode 100644 index 889aa259cc..0000000000 --- a/test/fixtures/transformation/es6-generators/try-finally-generator/exec.js +++ /dev/null @@ -1,114 +0,0 @@ -function *usingThrow(condition) { - yield 0; - try { - yield 1; - throw 2; - yield 3; - } finally { - if (condition) { - yield 4; - return 5; - } - yield 6; - return 7; - } -} - -function *usingRaise(condition) { - yield 0; - try { - yield 1; - genHelpers.raise(2); - yield 3; - } finally { - if (condition) { - yield 4; - return 5; - } - yield 6; - return 7; - } -} - -// should execute finally blocks statically -genHelpers.check(usingThrow(true), [0, 1, 4], 5); -genHelpers.check(usingThrow(false), [0, 1, 6], 7); - -// should execute finally blocks dynamically -genHelpers.check(usingRaise(true), [0, 1, 4], 5); -genHelpers.check(usingRaise(false), [0, 1, 6], 7); - -// should execute finally blocks before throwing -var uncaughtError = new Error("uncaught"); - -function *uncaught(condition) { - try { - yield 0; - if (condition) { - yield 1; - genHelpers.raise(uncaughtError); - } - yield 2; - } finally { - yield 3; - } - yield 4; -} - -genHelpers.check(uncaught(false), [0, 2, 3, 4]); - -var u = uncaught(true); - -assert.deepEqual(u.next(), { value: 0, done: false }); -assert.deepEqual(u.next(), { value: 1, done: false }); -assert.deepEqual(u.next(), { value: 3, done: false }); - -try { - u.next(); - assert.ok(false, "should have thrown an exception"); -} catch (err) { - assert.strictEqual(err, uncaughtError); -} - -// should throw correct error when finally contains catch -var right = new Error("right"); -var wrong = new Error("wrong"); - -function *gen() { - try { - yield 0; - genHelpers.raise(right); - } finally { - yield 1; - try { - genHelpers.raise(wrong); - } catch (err) { - assert.strictEqual(err, wrong); - yield 2; - } - } -} - -var g = gen(); - -assert.deepEqual(g.next(), { - value: 0, - done: false -}); - -assert.deepEqual(g.next(), { - value: 1, - done: false -}); - -assert.deepEqual(g.next(), { - value: 2, - done: false -}); - -try { - g.next(); - assert.ok(false, "should have thrown an exception"); -} catch (err) { - assert.strictEqual(err, right); -} diff --git a/test/fixtures/transformation/es6-generators/unqualified-function-calls-should-have-a-global-`this`-object/exec.js b/test/fixtures/transformation/es6-generators/unqualified-function-calls-should-have-a-global-`this`-object/exec.js deleted file mode 100644 index 35f5677b77..0000000000 --- a/test/fixtures/transformation/es6-generators/unqualified-function-calls-should-have-a-global-`this`-object/exec.js +++ /dev/null @@ -1,26 +0,0 @@ -function getThis() { - return this; -} - -// This is almost certainly the global object, but there's a chance it -// might be null or undefined (in strict mode). -var unqualifiedThis = getThis(); - -function *invoke() { - // It seems like a bug in the ES6 spec that we have to yield an - // argument instead of just calling (yield)(). - return (yield "dummy")(); -} - -var g = invoke(); -var info = g.next(); - -assert.deepEqual(info, { value: "dummy", done: false }); - -info = g.next(getThis); - -// Avoid using assert.strictEqual when the arguments might equal the -// global object, since JSON.stringify chokes on circular structures. -assert.ok(info.value === unqualifiedThis); - -assert.strictEqual(info.done, true); diff --git a/test/fixtures/transformation/es6-generators/yield-chain-should-have-correct-associativity/exec.js b/test/fixtures/transformation/es6-generators/yield-chain-should-have-correct-associativity/exec.js deleted file mode 100644 index 5918d1c894..0000000000 --- a/test/fixtures/transformation/es6-generators/yield-chain-should-have-correct-associativity/exec.js +++ /dev/null @@ -1,6 +0,0 @@ -function *gen(n) { - return yield yield yield yield n; -} - -genHelpers.check(gen(5), [5, 1, 2, 3], 4); -genHelpers.check(gen("asdf"), ["asdf", 1, 2, 3], 4); diff --git a/test/fixtures/transformation/es6-generators/yield-star-expression-results-can-be-used-in-complex-expressions/exec.js b/test/fixtures/transformation/es6-generators/yield-star-expression-results-can-be-used-in-complex-expressions/exec.js deleted file mode 100644 index ffe646947a..0000000000 --- a/test/fixtures/transformation/es6-generators/yield-star-expression-results-can-be-used-in-complex-expressions/exec.js +++ /dev/null @@ -1,22 +0,0 @@ -function pumpNumber(gen) { - var n = 0; - - while (true) { - var res = n > 0 ? gen.next(n) : gen.next(); - n = res.value; - if (res.done) { - return n; - } - } -} - -function* foo() { - return (yield* bar()) + (yield* bar()); -} - -function* bar() { - return (yield 2) + (yield 3); -} - -assert.strictEqual(pumpNumber(bar()), 5); -assert.strictEqual(pumpNumber(foo()), 10); diff --git a/test/fixtures/transformation/es6-generators/yield-star-expression-results-have-correct-values/exec.js b/test/fixtures/transformation/es6-generators/yield-star-expression-results-have-correct-values/exec.js deleted file mode 100644 index 8622122707..0000000000 --- a/test/fixtures/transformation/es6-generators/yield-star-expression-results-have-correct-values/exec.js +++ /dev/null @@ -1,11 +0,0 @@ -function* foo() { - yield 0; - return yield* bar(); -} - -function* bar() { - yield 1; - return 2; -} - -genHelpers.check(foo(), [0, 1], 2); diff --git a/test/fixtures/transformation/es7-async-functions/LICENSE b/test/fixtures/transformation/es7-async-functions/LICENSE deleted file mode 100644 index eba1d817f5..0000000000 --- a/test/fixtures/transformation/es7-async-functions/LICENSE +++ /dev/null @@ -1,7 +0,0 @@ -Copyright (c) 2014, Facebook, Inc. -All rights reserved. - -This source code is licensed under the BSD-style license found in the -https://raw.github.com/facebook/regenerator/master/LICENSE file. An -additional grant of patent rights can be found in the PATENTS file in -the same directory. diff --git a/test/fixtures/transformation/es7-async-functions/dependent-promises-should-be-awaitable-out-of-order/exec.js b/test/fixtures/transformation/es7-async-functions/dependent-promises-should-be-awaitable-out-of-order/exec.js deleted file mode 100644 index ef8e93ddcd..0000000000 --- a/test/fixtures/transformation/es7-async-functions/dependent-promises-should-be-awaitable-out-of-order/exec.js +++ /dev/null @@ -1,26 +0,0 @@ -async function outer(value) { - var resolved = false; - var p1 = new Promise(function(resolve) { - setTimeout(function() { - resolve(value + 1); - resolved = true; - }, 0); - }); - - assert.strictEqual(resolved, false); - - var v2 = await p1.then(function(value) { - return value + 1; - }); - - assert.strictEqual(resolved, true); - - var v1 = await p1; - - return [v1, v2]; -} - -outer(1).then(function(pair) { - assert.deepEqual(pair, [2, 3]); - done(); -}).catch(done); diff --git a/test/fixtures/transformation/es7-async-functions/nested-async-function-calls-should-evaluate-in-the-right-order/exec.js b/test/fixtures/transformation/es7-async-functions/nested-async-function-calls-should-evaluate-in-the-right-order/exec.js deleted file mode 100644 index 2e9ac0094f..0000000000 --- a/test/fixtures/transformation/es7-async-functions/nested-async-function-calls-should-evaluate-in-the-right-order/exec.js +++ /dev/null @@ -1,40 +0,0 @@ -var markers = []; - -async function innerMost(marker) { - markers.push(marker); - return await marker; -} - -async function inner(marker) { - markers.push(marker); - - assert.strictEqual( - await innerMost(marker + 1), - marker + 1 - ); - - markers.push(marker + 2); - - assert.strictEqual( - await innerMost(marker + 3), - marker + 3 - ); - - markers.push(marker + 4); -} - -async function outer() { - markers.push(0); - await inner(1); - markers.push(6); - await inner(7); - markers.push(12); -} - -outer().then(function() { - var expected = []; - for (var i = 0; i <= 12; ++i) - expected.push(i); - assert.deepEqual(markers, expected); - done(); -}).catch(done); diff --git a/test/fixtures/transformation/es7-async-functions/no-await-async-function-should-return-a-Promise/exec.js b/test/fixtures/transformation/es7-async-functions/no-await-async-function-should-return-a-Promise/exec.js deleted file mode 100644 index e4c0a55454..0000000000 --- a/test/fixtures/transformation/es7-async-functions/no-await-async-function-should-return-a-Promise/exec.js +++ /dev/null @@ -1,15 +0,0 @@ -var called = false; - -async function noAwait(value) { - called = true; - return value; -} - -var promise = noAwait("asdf"); -assert.strictEqual(called, true); - -promise.then(function(value) { - assert.strictEqual(called, true); - assert.strictEqual(value, "asdf"); - done(); -}).catch(done); diff --git a/test/fixtures/transformation/es7-async-functions/one-await-async-function-should-finish-asynchronously/exec.js b/test/fixtures/transformation/es7-async-functions/one-await-async-function-should-finish-asynchronously/exec.js deleted file mode 100644 index fae186c318..0000000000 --- a/test/fixtures/transformation/es7-async-functions/one-await-async-function-should-finish-asynchronously/exec.js +++ /dev/null @@ -1,19 +0,0 @@ -var flag1 = false; -var flag2 = false; - -async function oneAwait(value) { - flag1 = true; - var result = await value; - flag2 = true; - return result; -} - -var promise = oneAwait("asdf"); -assert.strictEqual(flag1, true); -assert.strictEqual(flag2, false); - -promise.then(function(value) { - assert.strictEqual(flag2, true); - assert.strictEqual(value, "asdf"); - done(); -}).catch(done); diff --git a/test/fixtures/transformation/es7-async-functions/options.json b/test/fixtures/transformation/es7-async-functions/options.json deleted file mode 100644 index 8a6dc3a088..0000000000 --- a/test/fixtures/transformation/es7-async-functions/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "asyncExec": true, - "experimental": true -} diff --git a/test/fixtures/transformation/es7-async-functions/rejected-promises-should-be-returned-by-exceptional-async-functions/exec.js b/test/fixtures/transformation/es7-async-functions/rejected-promises-should-be-returned-by-exceptional-async-functions/exec.js deleted file mode 100644 index 8eb9f6ce33..0000000000 --- a/test/fixtures/transformation/es7-async-functions/rejected-promises-should-be-returned-by-exceptional-async-functions/exec.js +++ /dev/null @@ -1,42 +0,0 @@ -var error = new Error("rejected"); - -async function e(arg) { - if (arg) { - throw arg; - } - return "did not throw"; -} - -async function f(arg) { - return await e(arg); -} - -async function g(arg) { - return await f(arg); -} - -async function h(arg) { - return await Promise.all([ - g(arg), - Promise.resolve("dummy") - ]); -} - -Promise.all([ - h(error).then(function() { - done(new Error("should not have resolved")); - }, function(e) { - assert.strictEqual(e, error); - return "ok1"; - }), - h(null).then(function(result) { - assert.deepEqual(result, [ - "did not throw", - "dummy" - ]); - return "ok2"; - }) -]).then(function(results) { - assert.deepEqual(results, ["ok1", "ok2"]); - done(); -}).catch(done); diff --git a/test/fixtures/transformation/es7-async-functions/rejected-promises-should-cause-await-expressions-to-throw/exec.js b/test/fixtures/transformation/es7-async-functions/rejected-promises-should-cause-await-expressions-to-throw/exec.js deleted file mode 100644 index 3abf9e0f9d..0000000000 --- a/test/fixtures/transformation/es7-async-functions/rejected-promises-should-cause-await-expressions-to-throw/exec.js +++ /dev/null @@ -1,21 +0,0 @@ -var error = new Error("rejected"); - -async function f(arg) { - try { - return await arg; - } catch (e) { - assert.strictEqual(e, error); - return "did throw"; - } -} - -Promise.all([ - f(Promise.reject(error)), - f(Promise.resolve("did not throw")) -]).then(function(results) { - assert.deepEqual(results, [ - "did throw", - "did not throw" - ]); - done(); -}).catch(done); diff --git a/test/regenerator.js b/test/regenerator.js new file mode 100644 index 0000000000..370405f117 --- /dev/null +++ b/test/regenerator.js @@ -0,0 +1,21 @@ +require("../register")({ + blacklist: ["useStrict"], + experimental: true +}); + +var transform = require("../lib/6to5/transformation/transform"); +var fs = require("fs"); +var _ = require("lodash"); + +var regeneratorLoc = __dirname + "/../vendor/regenerator"; + +if (!fs.existsSync(regeneratorLoc)) { + console.error("No vendor/regenerator - run `git submodule update --init && cd vendor/regenerator && npm install`"); + process.exit(1); +} + +_.each(["tests", "async"], function (filename) { + var loc = regeneratorLoc + "/test/" + filename + ".es6.js"; + var code = fs.readFileSync(loc, "utf8"); + require(loc); +}); diff --git a/vendor/regenerator b/vendor/regenerator new file mode 160000 index 0000000000..45829598be --- /dev/null +++ b/vendor/regenerator @@ -0,0 +1 @@ +Subproject commit 45829598be68fa4cb10f86b5ca13aa7284aa6bc8