summaryrefslogtreecommitdiff
path: root/test/built-ins/Function/prototype/toString/GeneratorFunction.js
blob: 523f1cd2a7be6a876e4aa7e212d6e20a177d6595 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// Copyright (C) 2016 Michael Ficarra. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-createdynamicfunction
description: Function.prototype.toString on a generator function created with the GeneratorFunction constructor
features: [generators]
---*/

let GeneratorFunction = Object.getPrototypeOf(function*(){}).constructor;
let g = /* before */GeneratorFunction("a", " /* a */ b, c /* b */ //", "/* c */ yield yield; /* d */ //")/* after */;

assert.sameValue(g.toString(), "function* anonymous(a, /* a */ b, c /* b */ //\n) {\n/* c */ yield yield; /* d */ //\n}");