Imported Upstream version 1.0.0
[platform/upstream/js.git] / js / src / tests / ecma_5 / Function / builtin-no-prototype.js
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * Any copyright is dedicated to the Public Domain.
4  * http://creativecommons.org/licenses/publicdomain/
5  */
6
7 assertEq(undefined, void 0);
8
9 assertEq(Function.prototype.hasOwnProperty('prototype'), false);
10 assertEq(Function.prototype.prototype, undefined);
11
12 var builtin_ctors = [
13     Object, Function, Array, String, Boolean, Number, Date, RegExp, Error,
14     EvalError, RangeError, ReferenceError, SyntaxError, TypeError, URIError
15 ];
16
17 for (var i = 0; i < builtin_ctors.length; i++) {
18     var c = builtin_ctors[i];
19     assertEq(typeof c.prototype, (c === Function) ? "function" : "object");
20     assertEq(c.prototype.constructor, c);
21 }
22
23 var builtin_funcs = [
24     eval, isFinite, isNaN, parseFloat, parseInt,
25     decodeURI, decodeURIComponent, encodeURI, encodeURIComponent
26 ];
27
28 for (var i = 0; i < builtin_funcs.length; i++) {
29     assertEq(builtin_funcs[i].hasOwnProperty('prototype'), false);
30     assertEq(builtin_funcs[i].prototype, undefined);
31 }
32
33 var names = Object.getOwnPropertyNames(Math);
34 for (var i = 0; i < names.length; i++) {
35     var m = Math[names[i]];
36     if (typeof m === "function")
37         assertEq(m.prototype, undefined);
38 }
39
40 reportCompare(0, 0, "don't crash");