mirror of https://github.com/svaarala/duktape.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
867 B
48 lines
867 B
12 years ago
|
/*===
|
||
|
TypeError
|
||
|
TypeError
|
||
|
TypeError
|
||
|
boolean object [object Boolean]
|
||
|
boolean object [object Boolean]
|
||
|
number object [object Number]
|
||
|
string object [object String]
|
||
|
object object [object Array]
|
||
|
object object [object Object]
|
||
|
===*/
|
||
|
|
||
|
function basicTest() {
|
||
|
function test(o, is_noarg) {
|
||
|
var t;
|
||
|
|
||
|
try {
|
||
|
var t;
|
||
|
|
||
|
if (is_noarg) {
|
||
|
t = Object.prototype.valueOf.call();
|
||
|
} else {
|
||
|
t = Object.prototype.valueOf.call(o);
|
||
|
}
|
||
|
print(typeof o, typeof t, Object.prototype.toString.call(t));
|
||
|
} catch (e) {
|
||
|
print(e.name);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
test(undefined, true);
|
||
|
test(undefined);
|
||
|
test(null);
|
||
|
test(true);
|
||
|
test(false);
|
||
|
test(123);
|
||
|
test('foo');
|
||
|
test([1,2]);
|
||
|
test({ foo: 1, bar: 2 });
|
||
|
}
|
||
|
|
||
|
try {
|
||
|
basicTest();
|
||
|
} catch (e) {
|
||
|
print(e);
|
||
|
}
|
||
|
|