Implement function.toString operation (#4752)
May increase the memory consumtpion heavily. JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
@@ -12,16 +12,27 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
assert (Math.cos.toString() === "function(){/* ecmascript */}");
|
||||
assert (Math.cos.toString() === "function () { [native code] }");
|
||||
|
||||
var has_toString = none.toString() != "function () { /* ecmascript */ }"
|
||||
|
||||
function check(f, expected)
|
||||
{
|
||||
assert (f.toString() === (has_toString ? expected : "function () { /* ecmascript */ }"))
|
||||
}
|
||||
|
||||
function none() { return 1; }
|
||||
assert (none.toString() === "function(){/* ecmascript */}");
|
||||
check (none, "function none() { return 1; }")
|
||||
assert (none.bind({}).toString() === "function () { [native code] }")
|
||||
|
||||
function single(b) { return 1; }
|
||||
assert (single.toString() === "function(){/* ecmascript */}");
|
||||
check (single, "function single(b) { return 1; }")
|
||||
assert (single.bind({}).toString() === "function () { [native code] }")
|
||||
|
||||
function multiple(a,b) { return 1; }
|
||||
assert (multiple.toString() === "function(){/* ecmascript */}");
|
||||
check (multiple, "function multiple(a,b) { return 1; }")
|
||||
assert (multiple.bind({}).toString() === "function () { [native code] }")
|
||||
|
||||
function lots(a,b,c,d,e,f,g,h,i,j,k) { return 1; }
|
||||
assert (lots.toString() === "function(){/* ecmascript */}");
|
||||
check (lots, "function lots(a,b,c,d,e,f,g,h,i,j,k) { return 1; }")
|
||||
assert (lots.bind({}).toString() === "function () { [native code] }")
|
||||
|
||||
Reference in New Issue
Block a user