Index: test/promises-aplus/lib/require.js |
diff --git a/test/mjsunit/regress/regress-347262.js b/test/promises-aplus/lib/require.js |
similarity index 70% |
copy from test/mjsunit/regress/regress-347262.js |
copy to test/promises-aplus/lib/require.js |
index 76bc34a2cdc068057516617671e01c1173c7b6f3..725e45e648351ae206fb654a8b0ca25ca90e4d4a 100644 |
--- a/test/mjsunit/regress/regress-347262.js |
+++ b/test/promises-aplus/lib/require.js |
@@ -25,38 +25,26 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-// Flags: --allow-natives-syntax |
+var global = this.global || {}; |
-(function ArgumentsObjectWithOtherArgumentsInFrame() { |
- function g() { |
- return g.arguments; |
+// Emulates 'require' function in Node. |
+// This is not a generic function: it only works for known modules. |
+var require = function(name) { |
+ var exports = {}; |
+ var path; |
+ var base = 'test/promises-aplus/' |
+ if (name.search('./helpers/') === 0) { |
+ path = base + 'promises-tests/lib/tests/' + name + '.js'; |
+ } else if (name === 'assert') { |
+ path = base + 'lib/assert.js'; |
+ } else if (name === 'sinon') { |
+ path = base + 'sinon/sinon.js'; |
+ } else { |
+ throw Error('We cannnot load the library: ' + name); |
} |
- |
- function f(x) { |
- g(); |
- return arguments[0]; |
- } |
- f(); |
- f(); |
- %OptimizeFunctionOnNextCall(f); |
- f(); |
-})(); |
- |
- |
-(function ArgumentsObjectWithOtherArgumentsDeopt() { |
- function g(y) { |
- y.o2 = 2; |
- return g.arguments; |
- } |
- |
- function f(x) { |
- var o1 = { o2 : 1 }; |
- var a = g(o1); |
- o1.o2 = 3; |
- return arguments[0] + a[0].o2; |
+ eval('(function() { ' + read(path) + '}())'); |
+ if (name === 'sinon') { |
+ return this.sinon; |
} |
- f(0); |
- f(0); |
- %OptimizeFunctionOnNextCall(f); |
- assertEquals(3, f(0)); |
-})(); |
+ return exports; |
+}; |