mirror of
https://github.com/tc39/test262.git
synced 2025-05-03 14:30:27 +02:00
* [javascriptcore-test262-automation] changes from git@github.com:WebKit/webkit.git at sha 949e26452cfa153a7f4afe593da97e2fe9e1b706 on Tue Jul 03 2018 14:35:15 GMT-0400 (Eastern Daylight Time)
41 lines
867 B
JavaScript
41 lines
867 B
JavaScript
function shouldBe(actual, expected)
|
|
{
|
|
if (actual !== expected)
|
|
throw new Error(`bad value: expected:(${expected}),actual:(${actual})`);
|
|
}
|
|
|
|
function toStringLeft(num)
|
|
{
|
|
return num + 'Cocoa';
|
|
}
|
|
noInline(toStringLeft);
|
|
|
|
function toStringRight(num)
|
|
{
|
|
return 'Cocoa' + num;
|
|
}
|
|
noInline(toStringRight);
|
|
|
|
function toStringLeftEmpty(num)
|
|
{
|
|
return num + '';
|
|
}
|
|
noInline(toStringLeftEmpty);
|
|
|
|
function toStringRightEmpty(num)
|
|
{
|
|
return '' + num;
|
|
}
|
|
noInline(toStringRightEmpty);
|
|
|
|
for (var i = 0; i < 1e4; ++i) {
|
|
shouldBe(toStringLeft(2), `2Cocoa`);
|
|
shouldBe(toStringRight(2), `Cocoa2`);
|
|
shouldBe(toStringLeftEmpty(2), `2`);
|
|
shouldBe(toStringRightEmpty(2), `2`);
|
|
shouldBe(toStringLeft(42), `42Cocoa`);
|
|
shouldBe(toStringRight(42), `Cocoa42`);
|
|
shouldBe(toStringLeftEmpty(42), `42`);
|
|
shouldBe(toStringRightEmpty(42), `42`);
|
|
}
|