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.
45 lines
790 B
45 lines
790 B
/*===
|
|
[object Undefined]
|
|
[object Null]
|
|
[object Boolean]
|
|
[object Boolean]
|
|
[object Number]
|
|
[object String]
|
|
[object Array]
|
|
[object Object]
|
|
[object Function]
|
|
[object RegExp]
|
|
[object Date]
|
|
[object Error]
|
|
[object JSON]
|
|
[object Math]
|
|
[object Function]
|
|
===*/
|
|
|
|
function basicTest() {
|
|
function test(v) {
|
|
print(Object.prototype.toString.call(v));
|
|
}
|
|
|
|
test(undefined);
|
|
test(null);
|
|
test(true);
|
|
test(false);
|
|
test(123);
|
|
test('foo');
|
|
test([1,2]);
|
|
test({ foo: 1, bar: 2 });
|
|
test(function(){});
|
|
test(/foo/);
|
|
test(new Date());
|
|
test(new Error('foo'));
|
|
test(JSON);
|
|
test(Math);
|
|
test(function f() { var indirect = eval; return indirect('this'); }); // indirect eval -> this=global
|
|
}
|
|
|
|
try {
|
|
basicTest();
|
|
} catch (e) {
|
|
print(e);
|
|
}
|
|
|