summaryrefslogtreecommitdiff
path: root/js/src/jit-test
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-03-20 10:08:54 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-03-20 10:10:12 +0100
commit893a886ea38853a1a3e97bcf135ea3cb616cd69a (patch)
tree5188f8895ce513381917d37115b50f72fb4e64a9 /js/src/jit-test
parent7197b308fb97cd8ab7a972df6a3a17a7a265b594 (diff)
parent6085bfdcecc2529c1037f813e70583c2a776677d (diff)
downloaduxp-893a886ea38853a1a3e97bcf135ea3cb616cd69a.tar.gz
Add support for the function `name` property.
This resolves #78. Merged remote-tracking branch 'janek/js_function_name_1'
Diffstat (limited to 'js/src/jit-test')
-rw-r--r--js/src/jit-test/tests/basic/constructor-name.js2
-rw-r--r--js/src/jit-test/tests/basic/functionnames.js32
-rw-r--r--js/src/jit-test/tests/debug/Memory-drainAllocationsLog-16.js2
-rw-r--r--js/src/jit-test/tests/saved-stacks/function-display-name.js5
-rw-r--r--js/src/jit-test/tests/self-test/assertDeepEq.js3
5 files changed, 22 insertions, 22 deletions
diff --git a/js/src/jit-test/tests/basic/constructor-name.js b/js/src/jit-test/tests/basic/constructor-name.js
index 4bc6a61ead..2dd4c073fc 100644
--- a/js/src/jit-test/tests/basic/constructor-name.js
+++ b/js/src/jit-test/tests/basic/constructor-name.js
@@ -17,7 +17,7 @@ function makeObject() {
let tests = [
{ name: "Ctor", object: new Ctor },
{ name: "nested.Ctor", object: new nested.Ctor },
- { name: "makeInstance/LexicalCtor", object: makeInstance() },
+ { name: "LexicalCtor", object: makeInstance() },
{ name: null, object: {} },
{ name: null, object: nested.object },
{ name: null, object: makeObject() },
diff --git a/js/src/jit-test/tests/basic/functionnames.js b/js/src/jit-test/tests/basic/functionnames.js
index 935292ee35..7fef872fce 100644
--- a/js/src/jit-test/tests/basic/functionnames.js
+++ b/js/src/jit-test/tests/basic/functionnames.js
@@ -40,7 +40,7 @@ assertName(Foo, 'Foo</<');
/* various properties and such */
var x = {fox: { bax: function(){} } };
-assertName(x.fox.bax, 'x.fox.bax');
+assertName(x.fox.bax, 'bax');
var foo = {foo: {foo: {}}};
foo.foo.foo = function(){};
assertName(foo.foo.foo, 'foo.foo.foo');
@@ -48,20 +48,20 @@ var z = {
foz: function() {
var baz = function() {
var y = {bay: function() {}};
- assertName(y.bay, 'z.foz/baz/y.bay');
+ assertName(y.bay, 'bay');
};
- assertName(baz, 'z.foz/baz');
+ assertName(baz, 'baz');
baz();
}
};
-assertName(z.foz, 'z.foz');
+assertName(z.foz, 'foz');
z.foz();
var outer = function() {
x.fox.bax.nx = function(){};
var w = {fow: { baw: function(){} } };
assertName(x.fox.bax.nx, 'outer/x.fox.bax.nx')
- assertName(w.fow.baw, 'outer/w.fow.baw');
+ assertName(w.fow.baw, 'baw');
};
assertName(outer, 'outer');
outer();
@@ -69,7 +69,7 @@ function Fuz(){};
Fuz.prototype = {
add: function() {}
}
-assertName(Fuz.prototype.add, 'Fuz.prototype.add');
+assertName(Fuz.prototype.add, 'add');
var x = 1;
x = function(){};
@@ -94,7 +94,7 @@ a.b = function() {
assertName(arguments.callee, 'a.b<');
return { a: function() {} }
}();
-assertName(a.b.a, 'a.b</<.a');
+assertName(a.b.a, 'a');
a = {
b: function(a) {
@@ -104,9 +104,9 @@ a = {
return function() {};
}
};
-assertName(a.b, 'a.b');
-assertName(a.b(true), 'a.b/<')
-assertName(a.b(false), 'a.b/<')
+assertName(a.b, 'b');
+assertName(a.b(true), 'b/<')
+assertName(a.b(false), 'b/<')
function f(g) {
assertName(g, 'x<');
@@ -116,7 +116,7 @@ var x = f(function () { return function() {}; });
assertName(x, 'x</<');
var a = {'b': function(){}};
-assertName(a.b, 'a.b');
+assertName(a.b, 'b');
function g(f) {
assertName(f, '');
@@ -138,15 +138,15 @@ a = {
"\"\'quotes\'\"": function(){},
"!@#$%": function(){}
};
-assertName(a["embedded spaces"], 'a["embedded spaces"]');
-assertName(a["dots.look.like.property.references"], 'a["dots.look.like.property.references"]');
-assertName(a["\"\'quotes\'\""], 'a["\\\"\'quotes\'\\\""]');
-assertName(a["!@#$%"], 'a["!@#$%"]');
+assertName(a["embedded spaces"], 'embedded spaces');
+assertName(a["dots.look.like.property.references"], 'dots.look.like.property.references');
+assertName(a["\"\'quotes\'\""], '"\'quotes\'"');
+assertName(a["!@#$%"], '!@#$%');
a.b = {};
a.b.c = {};
a.b["c"]["d e"] = { f: { 1: { "g": { "h i": function() {} } } } };
-assertName(a.b.c["d e"].f[1].g["h i"], 'a.b.c["d e"].f[1].g["h i"]');
+assertName(a.b.c["d e"].f[1].g["h i"], 'h i');
this.m = function () {};
assertName(m, "this.m");
diff --git a/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-16.js b/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-16.js
index b147d6ded0..5c73a1ad30 100644
--- a/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-16.js
+++ b/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-16.js
@@ -24,7 +24,7 @@ root.eval(
this.tests = [
{ name: "Ctor", fn: () => new Ctor },
{ name: "nested.Ctor", fn: () => new nested.Ctor },
- { name: "makeInstance/LexicalCtor", fn: () => makeInstance() },
+ { name: "LexicalCtor", fn: () => makeInstance() },
{ name: null, fn: () => ({}) },
{ name: null, fn: () => (nested.object = {}) },
{ name: null, fn: () => makeObject() },
diff --git a/js/src/jit-test/tests/saved-stacks/function-display-name.js b/js/src/jit-test/tests/saved-stacks/function-display-name.js
index cfe175758c..f10b7de6bd 100644
--- a/js/src/jit-test/tests/saved-stacks/function-display-name.js
+++ b/js/src/jit-test/tests/saved-stacks/function-display-name.js
@@ -2,9 +2,8 @@
function uno() { return dos(); }
const dos = () => tres.quattro();
-const tres = {
- quattro: () => saveStack()
-};
+let tres = {};
+tres.quattro = () => saveStack()
const frame = uno();
diff --git a/js/src/jit-test/tests/self-test/assertDeepEq.js b/js/src/jit-test/tests/self-test/assertDeepEq.js
index b2a949abc6..9c1b37e8e3 100644
--- a/js/src/jit-test/tests/self-test/assertDeepEq.js
+++ b/js/src/jit-test/tests/self-test/assertDeepEq.js
@@ -77,7 +77,8 @@ assertDeepEq(q, p);
assertNotDeepEq(() => 1, () => 2);
assertNotDeepEq((...x) => 1, x => 1);
assertNotDeepEq(function f(){}, function g(){});
-var f1 = function () {}, f2 = function () {};
+// Avoid setting name property.
+var [f1, f2] = [function () {}, function () {}];
assertDeepEq(f1, f1);
assertDeepEq(f1, f2); // same text, close enough
f1.prop = 1;