Rearrange String.prototype.indexOf, lastIndexOf and Replace helpers
Fixes issue #515 JerryScript-DCO-1.0-Signed-off-by: Laszlo Vidacs lvidacs.u-szeged@partner.samsung.com
This commit is contained in:
@@ -85,7 +85,7 @@ assert("Hello world, welcome to the universe.".indexOf("welcome", undefined_var)
|
||||
// check booleans
|
||||
assert("true".indexOf(true, false) === 0);
|
||||
|
||||
// check this is undefined
|
||||
// check coercible - undefined
|
||||
try {
|
||||
String.prototype.indexOf.call(undefined);
|
||||
assert(false);
|
||||
@@ -93,7 +93,7 @@ try {
|
||||
assert(e instanceof TypeError);
|
||||
}
|
||||
|
||||
// check this is null
|
||||
// check coercible - null
|
||||
try {
|
||||
String.prototype.indexOf.call(null);
|
||||
assert(false);
|
||||
@@ -101,24 +101,9 @@ try {
|
||||
assert(e instanceof TypeError);
|
||||
}
|
||||
|
||||
// check coercible - undefined
|
||||
try {
|
||||
assert(true.indexOf());
|
||||
assert(false);
|
||||
} catch (e) {
|
||||
assert(e instanceof TypeError);
|
||||
}
|
||||
|
||||
// check coercible - null
|
||||
try {
|
||||
assert(isNaN(String.prototype.indexOf.call(null, 0)));
|
||||
assert(false);
|
||||
} catch (e) {
|
||||
assert(e instanceof TypeError);
|
||||
}
|
||||
|
||||
// check coercible - Boolean
|
||||
assert(String.prototype.indexOf.call(true, "e") === 3);
|
||||
assert(String.prototype.indexOf.call(false, "e") === 4);
|
||||
|
||||
// check coercible - Object
|
||||
var test_object = {firstName:"John", lastName:"Doe"};
|
||||
|
||||
Reference in New Issue
Block a user