diff --git a/RELEASES.rst b/RELEASES.rst index 3d202c3c..20cfab4e 100644 --- a/RELEASES.rst +++ b/RELEASES.rst @@ -2000,6 +2000,10 @@ Planned bound function internal prototype is copied from the target function instead of always being Function.prototype (GH-1135) +* Change Function.prototype.toString() output to match ES6 requirements; + the output no longer parses with eval() but causes a SyntaxError instead + (GH-1141) + * Add a fastint check for duk_put_number_list() values (GH-1086) * Remove an unintended fastint downgrade check for unary minus executor diff --git a/doc/release-notes-v2-0.rst b/doc/release-notes-v2-0.rst index 3b9f44e7..40ee8b2b 100644 --- a/doc/release-notes-v2-0.rst +++ b/doc/release-notes-v2-0.rst @@ -1062,6 +1062,10 @@ Other incompatible changes ES6 requirements; in ES5 (and Duktape 1.x) bound function internal prototype is always set to Function.prototype. +* Function.prototype.toString() output has been changed to match ES6 + requirements. For example ``function foo() {"ecmascript"}`` is now + ``function foo() { [ecmascript code] }``. + Known issues ============ diff --git a/src-input/duk_api_stack.c b/src-input/duk_api_stack.c index 920c9aba..f5536787 100644 --- a/src-input/duk_api_stack.c +++ b/src-input/duk_api_stack.c @@ -4843,7 +4843,7 @@ DUK_INTERNAL void duk_push_lightfunc_tostring(duk_context *ctx, duk_tval *tv) { duk_push_string(ctx, "function "); duk_push_lightfunc_name_raw(ctx, func, lf_flags); - duk_push_string(ctx, "() {\"light\"}"); + duk_push_string(ctx, "() { [lightfunc code] }"); duk_concat(ctx, 3); } diff --git a/src-input/duk_bi_function.c b/src-input/duk_bi_function.c index 7d4818ff..abb32d49 100644 --- a/src-input/duk_bi_function.c +++ b/src-input/duk_bi_function.c @@ -95,24 +95,26 @@ DUK_INTERNAL duk_ret_t duk_bi_function_prototype_to_string(duk_context *ctx) { /* * E5 Section 15.3.4.2 places few requirements on the output of - * this function: + * this function: the result is implementation dependent, must + * follow FunctionDeclaration syntax (in particular, must have a + * name even for anonymous functions or functions with empty name). + * The output does NOT need to compile into anything useful. * - * - The result is an implementation dependent representation - * of the function; in particular + * E6 Section 19.2.3.5 changes the requirements completely: the + * result must either eval() to a functionally equivalent object + * OR eval() to a SyntaxError. * - * - The result must follow the syntax of a FunctionDeclaration. - * In particular, the function must have a name (even in the - * case of an anonymous function or a function with an empty - * name). + * We opt for the SyntaxError approach for now, with a syntax that + * mimics V8's native function syntax: * - * - Note in particular that the output does NOT need to compile - * into anything useful. + * 'function cos() { [native code] }' + * + * but extended with [ecmascript code], [bound code], and + * [lightfunc code]. */ - - /* XXX: faster internal way to get this */ duk_push_this(ctx); - tv = duk_get_tval(ctx, -1); + tv = DUK_GET_TVAL_NEGIDX(ctx, -1); DUK_ASSERT(tv != NULL); if (DUK_TVAL_IS_OBJECT(tv)) { @@ -120,10 +122,11 @@ DUK_INTERNAL duk_ret_t duk_bi_function_prototype_to_string(duk_context *ctx) { const char *func_name; /* Function name: missing/undefined is mapped to empty string, - * otherwise coerce to string. - */ - /* XXX: currently no handling for non-allowed identifier characters, - * e.g. a '{' in the function name. + * otherwise coerce to string. No handling for invalid identifier + * characters or e.g. '{' in the function name. This doesn't + * really matter as long as a SyntaxError results. Technically + * if the name contained a suitable prefix followed by '//' it + * might cause the result to parse without error. */ duk_get_prop_stridx(ctx, -1, DUK_STRIDX_NAME); if (duk_is_undefined(ctx, -1)) { @@ -133,15 +136,12 @@ DUK_INTERNAL duk_ret_t duk_bi_function_prototype_to_string(duk_context *ctx) { DUK_ASSERT(func_name != NULL); } - /* Indicate function type in the function body using a dummy - * directive. - */ if (DUK_HOBJECT_IS_COMPFUNC(obj)) { - duk_push_sprintf(ctx, "function %s() {\"ecmascript\"}", (const char *) func_name); + duk_push_sprintf(ctx, "function %s() { [ecmascript code] }", (const char *) func_name); } else if (DUK_HOBJECT_IS_NATFUNC(obj)) { - duk_push_sprintf(ctx, "function %s() {\"native\"}", (const char *) func_name); + duk_push_sprintf(ctx, "function %s() { [native code] }", (const char *) func_name); } else if (DUK_HOBJECT_IS_BOUNDFUNC(obj)) { - duk_push_sprintf(ctx, "function %s() {\"bound\"}", (const char *) func_name); + duk_push_sprintf(ctx, "function %s() { [bound code] }", (const char *) func_name); } else { goto type_error; } diff --git a/tests/api/test-dev-api-verbose-error-messages-gh441.c b/tests/api/test-dev-api-verbose-error-messages-gh441.c index 7b964d37..d6e458a0 100644 --- a/tests/api/test-dev-api-verbose-error-messages-gh441.c +++ b/tests/api/test-dev-api-verbose-error-messages-gh441.c @@ -120,14 +120,14 @@ TypeError: buffer required, found [object Function] (stack index -3) TypeError: pointer required, found [object Function] (stack index -3) test__c_function ok top: 1 -TypeError: undefined required, found function LFUNC() {"light"} (stack index -3) -TypeError: null required, found function LFUNC() {"light"} (stack index -3) -TypeError: boolean required, found function LFUNC() {"light"} (stack index -3) -TypeError: number required, found function LFUNC() {"light"} (stack index -3) -TypeError: string required, found function LFUNC() {"light"} (stack index -3) -TypeError: buffer required, found function LFUNC() {"light"} (stack index -3) -TypeError: pointer required, found function LFUNC() {"light"} (stack index -3) -TypeError: nativefunction required, found function LFUNC() {"light"} (stack index -3) +TypeError: undefined required, found function LFUNC() { [lightfunc code] } (stack index -3) +TypeError: null required, found function LFUNC() { [lightfunc code] } (stack index -3) +TypeError: boolean required, found function LFUNC() { [lightfunc code] } (stack index -3) +TypeError: number required, found function LFUNC() { [lightfunc code] } (stack index -3) +TypeError: string required, found function LFUNC() { [lightfunc code] } (stack index -3) +TypeError: buffer required, found function LFUNC() { [lightfunc code] } (stack index -3) +TypeError: pointer required, found function LFUNC() { [lightfunc code] } (stack index -3) +TypeError: nativefunction required, found function LFUNC() { [lightfunc code] } (stack index -3) top: 1 TypeError: undefined required, found [object Function] (stack index -3) TypeError: null required, found [object Function] (stack index -3) diff --git a/tests/api/test-dev-func-tostring.c b/tests/api/test-dev-func-tostring.c index 3bfb0733..615eb7f4 100644 --- a/tests/api/test-dev-func-tostring.c +++ b/tests/api/test-dev-func-tostring.c @@ -1,13 +1,13 @@ /* - * Test the updated Function .toString() format in Duktape 1.5.0. + * Test the current Function .toString() format. * * Cover a few cases which cannot be exercised using Ecmascript code alone. */ /*=== *** test_1 (duk_safe_call) -function light_PTR() {"light"} -function dummy {() {"native"} +function light_PTR() { [lightfunc code] } +function dummy {() { [native code] } final top: 0 ==> rc=0, result='undefined' ===*/ diff --git a/tests/api/test-dev-lightfunc.c b/tests/api/test-dev-lightfunc.c index ee990c61..68a91f12 100644 --- a/tests/api/test-dev-lightfunc.c +++ b/tests/api/test-dev-lightfunc.c @@ -928,7 +928,7 @@ static duk_ret_t test_to_object(duk_context *ctx, void *udata) { /*=== *** test_to_buffer (duk_safe_call) -function light_PTR_4232() {"light"} +function light_PTR_4232() { [lightfunc code] } final top: 1 ==> rc=0, result='undefined' ===*/ diff --git a/tests/api/test-dev-plain-buffer.c b/tests/api/test-dev-plain-buffer.c index 3ac02d3f..d012f4b9 100644 --- a/tests/api/test-dev-plain-buffer.c +++ b/tests/api/test-dev-plain-buffer.c @@ -144,15 +144,15 @@ flag index: 2, top: 2 - byteLength: 16 - byteOffset: 0 - BYTES_PER_ELEMENT: 1 -- constructor: function ArrayBuffer() {"native"} -- slice: function slice() {"native"} +- constructor: function ArrayBuffer() { [native code] } +- slice: function slice() { [native code] } - __proto__: [object Object] -- toString: function toString() {"native"} -- toLocaleString: function toLocaleString() {"native"} -- valueOf: function valueOf() {"native"} -- hasOwnProperty: function hasOwnProperty() {"native"} -- isPrototypeOf: function isPrototypeOf() {"native"} -- propertyIsEnumerable: function propertyIsEnumerable() {"native"} +- toString: function toString() { [native code] } +- toLocaleString: function toLocaleString() { [native code] } +- valueOf: function valueOf() { [native code] } +- hasOwnProperty: function hasOwnProperty() { [native code] } +- isPrototypeOf: function isPrototypeOf() { [native code] } +- propertyIsEnumerable: function propertyIsEnumerable() { [native code] } flag index: 3, top: 2 - 0: 100 - 1: 101 diff --git a/tests/api/test-push-object.c b/tests/api/test-push-object.c index e0afdff1..49ba5313 100644 --- a/tests/api/test-push-object.c +++ b/tests/api/test-push-object.c @@ -1,6 +1,6 @@ /*=== duk_is_object(1) = 1 -.toString rc=1 -> function toString() {"native"} +.toString rc=1 -> function toString() { [native code] } json encoded: {"meaningOfLife":42} top=2 ===*/ diff --git a/tests/ecmascript/test-bi-function-bind-name.js b/tests/ecmascript/test-bi-function-proto-bind-name.js similarity index 100% rename from tests/ecmascript/test-bi-function-bind-name.js rename to tests/ecmascript/test-bi-function-proto-bind-name.js diff --git a/tests/ecmascript/test-bi-function-proto-tostring-custom.js b/tests/ecmascript/test-bi-function-proto-tostring-custom.js new file mode 100644 index 00000000..0da95123 --- /dev/null +++ b/tests/ecmascript/test-bi-function-proto-tostring-custom.js @@ -0,0 +1,36 @@ +/* + * Duktape custom behavior for Function.prototype.toString(). + */ + +/*--- +{ + "custom": true +} +---*/ + +/*=== +function foo() { [ecmascript code] } +function cos() { [native code] } +function bound foo() { [bound code] } +function bound cos() { [bound code] } +===*/ + +function test() { + var scriptFunc = function foo() {}; + var nativeFunc = Math.cos; + var boundFunc1 = scriptFunc.bind(null, 1); + var boundFunc2 = nativeFunc.bind(null, 1); + + [ scriptFunc, nativeFunc, boundFunc1, boundFunc2 ].forEach(function (v) { + print(String(v)); + }); + + // Lightfunc and some other cases are covered by + // tests/api/test-dev-func-tostring.c. +} + +try { + test(); +} catch (e) { + print(e.stack || e); +} diff --git a/tests/ecmascript/test-bi-function-proto-tostring.js b/tests/ecmascript/test-bi-function-proto-tostring.js new file mode 100644 index 00000000..09c5ea31 --- /dev/null +++ b/tests/ecmascript/test-bi-function-proto-tostring.js @@ -0,0 +1,39 @@ +/* + * Function.prototype.toString() requirements were quite general in ES5: + * output must parse as FunctionDeclaration but doesn't need to compile + * into useful code. + * + * ES6 requires that the source code eval()s to an equivalent object or, + * if that's not possible, evals to a SyntaxError. + * + * Duktape 2.x follows the ES6 requirements. + */ + +/*=== +SyntaxError +SyntaxError +SyntaxError +SyntaxError +===*/ + +function test() { + var scriptFunc = function foo() {}; + var nativeFunc = Math.cos; + var boundFunc1 = scriptFunc.bind(null, 1); + var boundFunc2 = nativeFunc.bind(null, 1); + + [ scriptFunc, nativeFunc, boundFunc1, boundFunc2 ].forEach(function (v) { + try { + var res = eval(String(v)); + print('never here:', typeof res); + } catch (e) { + print(e.name); + } + }); +} + +try { + test(); +} catch (e) { + print(e.stack || e); +} diff --git a/tests/ecmascript/test-bi-reflect-arg-policy.js b/tests/ecmascript/test-bi-reflect-arg-policy.js index 9fe36001..fb15862d 100644 --- a/tests/ecmascript/test-bi-reflect-arg-policy.js +++ b/tests/ecmascript/test-bi-reflect-arg-policy.js @@ -45,7 +45,7 @@ true true 812 [object Object] -function () {"native"} +function () { [native code] } false true name,fileName,length,prototype,test diff --git a/tests/ecmascript/test-conv-tostring.js b/tests/ecmascript/test-conv-tostring.js index 1f78054e..af6192fd 100644 --- a/tests/ecmascript/test-conv-tostring.js +++ b/tests/ecmascript/test-conv-tostring.js @@ -18,7 +18,7 @@ 3 string false 4 string 123 5 string foo -6 string function myfunc() {"ecmascript"} +6 string function myfunc() { [ecmascript code] } 7 string [object Object] 8 TypeError 9 string foo diff --git a/tests/ecmascript/test-dev-func-tostring.js b/tests/ecmascript/test-dev-func-tostring.js deleted file mode 100644 index 9f893e09..00000000 --- a/tests/ecmascript/test-dev-func-tostring.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Test the updated Function .toString() format in Duktape 1.5.0. - */ - -/*--- -{ - "custom": true -} ----*/ - -/*=== -function () {"ecmascript"} -function foo() {"ecmascript"} -function cos() {"native"} -===*/ - -function test() { - var fn; - - // Anonymous function - fn = function (){}; - print(fn); - - // Named function - fn = function foo(){}; - print(fn); - - // Native function - fn = Math.cos; - print(fn); - - // Lightfunc and some other cases are covered by - // tests/api/test-dev-func-tostring.c. -} - -try { - test(); -} catch (e) { - print(e.stack || e); -} diff --git a/tests/ecmascript/test-dev-lightfunc.js b/tests/ecmascript/test-dev-lightfunc.js index f67374c8..a38fcaaa 100644 --- a/tests/ecmascript/test-dev-lightfunc.js +++ b/tests/ecmascript/test-dev-lightfunc.js @@ -490,9 +490,9 @@ try { /*=== arithmetic test -string: testfunction light_PTR_0511() {"light"}function light_PTR_0a11() {"light"} -string: function light_PTR_0511() {"light"}function light_PTR_0a11() {"light"} -string: function foo() {"ecmascript"}function bar() {"ecmascript"} +string: testfunction light_PTR_0511() { [lightfunc code] }function light_PTR_0a11() { [lightfunc code] } +string: function light_PTR_0511() { [lightfunc code] }function light_PTR_0a11() { [lightfunc code] } +string: function foo() { [ecmascript code] }function bar() { [ecmascript code] } ===*/ function arithmeticTest() { @@ -514,9 +514,9 @@ try { /*=== toString() test -function light_PTR_002f() {"light"} -function light_PTR_002f() {"light"} -function light_PTR_002f() {"light"} +function light_PTR_002f() { [lightfunc code] } +function light_PTR_002f() { [lightfunc code] } +function light_PTR_002f() { [lightfunc code] } true true ===*/ @@ -643,8 +643,8 @@ try { /*=== toBuffer() test -object: function light_PTR_0511() {"light"} -object: function light_PTR_0a11() {"light"} +object: function light_PTR_0511() { [lightfunc code] } +object: function light_PTR_0a11() { [lightfunc code] } ===*/ function toBufferTest() { @@ -1120,15 +1120,15 @@ try { /*=== bound function test -F: function light_PTR_002f() {"light"} +F: function light_PTR_002f() { [lightfunc code] } F type tag: 9 -G: function light_PTR_002f() {"bound"} +G: function bound light_PTR_002f() { [bound code] } G type tag: 6 G.length: 1 -H: function light_PTR_002f() {"bound"} +H: function bound bound light_PTR_002f() { [bound code] } H type tag: 6 H.length: 0 -I: function light_PTR_002f() {"bound"} +I: function bound bound bound light_PTR_002f() { [bound code] } I type tag: 6 I.length: 0 G(123): 234 @@ -1189,8 +1189,8 @@ toString coerced object (return "length") read from length -> 2 read from testWritable -> 123 read from testNonWritable -> 234 -read from call -> function light_PTR_001f() {"light"} -read from apply -> function light_PTR_0022() {"light"} +read from call -> function light_PTR_001f() { [lightfunc code] } +read from apply -> function light_PTR_0022() { [lightfunc code] } read from nonexistent -> undefined ===*/ @@ -2393,7 +2393,7 @@ act: undefined undefined gc: boolean true fin-get: TypeError fin-set: TypeError -encdec-hex: string "function light_PTR_0511() {\"light\"}" +encdec-hex: string "function light_PTR_0511() { [lightfunc code] }" dec-hex: TypeError compact: function {_func:true} ===*/ @@ -2456,9 +2456,9 @@ try { /*=== Function built-in test -Function: function {_func:true} -new Function: function {_func:true} -toString: string "function light_PTR_0511() {\"light\"}" +Function: SyntaxError +new Function: SyntaxError +toString: string "function light_PTR_0511() { [lightfunc code] }" valueOf: function {_func:true} ===*/ @@ -2490,8 +2490,8 @@ parseInt: number NaN parseFloat: number NaN isNaN: boolean true isFinite: boolean false -decodeURI: string "function light_PTR_0511() {\"light\"}" -decodeURIComponent: string "function light_PTR_0511() {\"light\"}" +decodeURI: string "function light_PTR_0511() { [lightfunc code] }" +decodeURIComponent: string "function light_PTR_0511() { [lightfunc code] }" encodeURI: string "string" encodeURIComponent: string "string" escape: string "string" @@ -2555,7 +2555,7 @@ Duktape.Logger: TypeError new Duktape.Logger: object {} fmt: TypeError raw: TypeError -TIMESTAMP INF test: My light func is: function light_PTR_0511() {"light"} +TIMESTAMP INF test: My light func is: function light_PTR_0511() { [lightfunc code] } ===*/ function duktapeLoggerBuiltinTest() { @@ -2686,7 +2686,7 @@ isSealed: boolean true isFrozen: boolean true isExtensible: boolean false toString: string "[object Function]" -toLocaleString: string "function light_PTR_0511() {\"native\"}" +toLocaleString: string "function light_PTR_0511() { [native code] }" valueOf: function {_func:true} isPrototypeOf: boolean false ===*/ @@ -2759,26 +2759,26 @@ try { Proxy built-in test get this: object false [object Object] -target: function false function light_PTR_0511() {"native"} +target: function false function light_PTR_0511() { [native code] } key: string name proxy.name: light_PTR_0511 get this: object false [object Object] -target: function false function light_PTR_0511() {"native"} +target: function false function light_PTR_0511() { [native code] } key: string length proxy.length: 1 get this: object false [object Object] -target: function false function light_PTR_0511() {"native"} +target: function false function light_PTR_0511() { [native code] } key: string nonExistent proxy.nonExistent: dummy get -this: function false function light_PTR_0511() {"native"} +this: function false function light_PTR_0511() { [native code] } target: object false [object Object] key: string foo proxy.foo: bar get -this: function false function light_PTR_0511() {"native"} +this: function false function light_PTR_0511() { [native code] } target: object false [object Object] key: string nonExistent proxy.nonExistent: dummy @@ -2865,30 +2865,30 @@ try { /*=== String built-in test -String: string "function light_PTR_0511() {\"light\"}" -new String: string "function light_PTR_0511() {\"light\"}" +String: string "function light_PTR_0511() { [lightfunc code] }" +new String: string "function light_PTR_0511() { [lightfunc code] }" new String: string "object" fromCharCode: string "\x00" toString: TypeError valueOf: TypeError charAt: string "f" charCodeAt: number 102 -concat: string "function light_PTR_0511() {\"light\"}function light_PTR_0511() {\"light\"}" +concat: string "function light_PTR_0511() { [lightfunc code] }function light_PTR_0511() { [lightfunc code] }" indexOf: number 0 lastIndexOf: number 0 localeCompare: number 0 match: object null replace: string "undefined" search: number -1 -slice: string "function light_PTR_0511() {\"light\"}" +slice: string "function light_PTR_0511() { [lightfunc code] }" split: object ["",""] -substring: string "function light_PTR_0511() {\"light\"}" -toLowerCase: string "function light_PTR_0511() {\"light\"}" -toLocaleLowerCase: string "function light_PTR_0511() {\"light\"}" -toUpperCase: string "FUNCTION LIGHT_PTR_0511() {\"LIGHT\"}" -toLocaleUpperCase: string "FUNCTION LIGHT_PTR_0511() {\"LIGHT\"}" -trim: string "function light_PTR_0511() {\"light\"}" -substr: string "function light_PTR_0511() {\"light\"}" +substring: string "function light_PTR_0511() { [lightfunc code] }" +toLowerCase: string "function light_PTR_0511() { [lightfunc code] }" +toLocaleLowerCase: string "function light_PTR_0511() { [lightfunc code] }" +toUpperCase: string "FUNCTION LIGHT_PTR_0511() { [LIGHTFUNC CODE] }" +toLocaleUpperCase: string "FUNCTION LIGHT_PTR_0511() { [LIGHTFUNC CODE] }" +trim: string "function light_PTR_0511() { [lightfunc code] }" +substr: string "function light_PTR_0511() { [lightfunc code] }" ===*/ function stringBuiltinTest() { diff --git a/tests/ecmascript/test-dev-plain-buffer.js b/tests/ecmascript/test-dev-plain-buffer.js index 1e23f846..4b036281 100644 --- a/tests/ecmascript/test-dev-plain-buffer.js +++ b/tests/ecmascript/test-dev-plain-buffer.js @@ -1098,7 +1098,7 @@ TypeError TypeError undefined undefined -function dummy() {"ecmascript"} +function dummy() { [ecmascript code] } - enc |6162636465666768696a6b6c6d6e6f70| {"_buf":"6162636465666768696a6b6c6d6e6f70"} diff --git a/tests/ecmascript/test-dev-primary-identifier.js b/tests/ecmascript/test-dev-primary-identifier.js index 2c4704e4..e61fa763 100644 --- a/tests/ecmascript/test-dev-primary-identifier.js +++ b/tests/ecmascript/test-dev-primary-identifier.js @@ -6,10 +6,10 @@ foo foo 234 -function inner() {"ecmascript"} +function inner() { [ecmascript code] } 123 234 -function inner() {"ecmascript"} +function inner() { [ecmascript code] } 123 ===*/ diff --git a/tests/knownissues/test-dev-lightfunc-2.txt b/tests/knownissues/test-dev-lightfunc-2.txt new file mode 100644 index 00000000..aaa59475 --- /dev/null +++ b/tests/knownissues/test-dev-lightfunc-2.txt @@ -0,0 +1,750 @@ +summary: requires DUK_USE_LIGHTFUNC_BUILTINS +--- +light func support test +info.length: 9 +typeof: function +6 +typeof test +function +property assignment test +strPlainNonStrict: success +strPlainStrict: TypeError +strObjectNonStrict: success +strObjectStrict: success +strObjectNonextNonStrict: success +strObjectNonextStrict: TypeError +lfuncNonStrict1: success +lfuncNonStrict2: success +lfuncStrict1: TypeError +lfuncStrict2: success +instanceof test +{} instanceof lightfunc: TypeError +false +{} instanceof func-wo-prototype: TypeError +lightFunc instanceof Function: true +lightFunc instanceof Number: false +lightFunc instanceof Object: true +comparison test +0 0 true true +0 1 false false +0 2 false false +0 3 true true +0 4 false false +0 5 false false +0 6 false false +1 0 false false +1 1 true true +1 2 false false +1 3 false false +1 4 true true +1 5 false false +1 6 false false +2 0 false false +2 1 false false +2 2 true true +2 3 false false +2 4 false false +2 5 true true +2 6 false false +3 0 true true +3 1 false false +3 2 false false +3 3 true true +3 4 false false +3 5 false false +3 6 false false +4 0 false false +4 1 true true +4 2 false false +4 3 false false +4 4 true true +4 5 false false +4 6 false false +5 0 false false +5 1 false false +5 2 true true +5 3 false false +5 4 false false +5 5 true true +5 6 false false +6 0 false false +6 1 false false +6 2 false false +6 3 false false +6 4 false false +6 5 false false +6 6 true true +arithmetic test +string: testfunction cos() {"native"}function sin() {"native"} +string: function cos() {"native"}function sin() {"native"} +string: function foo() {"ecmascript"}function bar() {"ecmascript"} +toString() test +function max() {"native"} +function max() {"native"} +function max() {"native"} +true +true +toObject() test +caching: true +length: 2 2 +name: max max +typeof: function function +internal prototype is Function.prototype: true true +external prototype is not set: true +internal prototypes match: true +external prototypes match (do not exist): true +isExtensible: true true +Math.max test: 9 9 +length: 1 1 +toBoolean() test +true +true +toBuffer() test +object: function cos() {"native"} +object: function sin() {"native"} +toPointer() test +pointer false +object false +number coercion test +NaN +NaN +0 +0 +0 +0 +0 +0 +call and apply test +call +321 +apply +987 +this coercion test +function false +function false +inherit from Function.prototype test +testValue +Object.prototype.toString() test +[object Function] +JSON/JX/JC test +json +undefined +undefined +jx +{_func:true} +{_func:true} +jc +{"_func":true} +{"_func":true} +json +undefined +undefined +jx +{_func:true} +{_func:true} +jc +{"_func":true} +{"_func":true} +json +{"array":[100,null,200,null,300]} +{ + "array": [ + 100, + null, + 200, + null, + 300 + ] +} +jx +{lf:{_func:true},nf:{_func:true},array:[100,{_func:true},200,{_func:true},300]} +{ + lf: {_func:true}, + nf: {_func:true}, + array: [ + 100, + {_func:true}, + 200, + {_func:true}, + 300 + ] +} +jc +{"lf":{"_func":true},"nf":{"_func":true},"array":[100,{"_func":true},200,{"_func":true},300]} +{ + "lf": {"_func":true}, + "nf": {"_func":true}, + "array": [ + 100, + {"_func":true}, + 200, + {"_func":true}, + 300 + ] +} +json +"toJsonRetval" +"toJsonRetval" +jx +"toJsonRetval" +"toJsonRetval" +jc +"toJsonRetval" +"toJsonRetval" +json +"toJsonRetval" +"toJsonRetval" +jx +"toJsonRetval" +"toJsonRetval" +jc +"toJsonRetval" +"toJsonRetval" +json +{"lf":"toJsonRetval","nf":"toJsonRetval","array":[100,"toJsonRetval",200,"toJsonRetval",300]} +{ + "lf": "toJsonRetval", + "nf": "toJsonRetval", + "array": [ + 100, + "toJsonRetval", + 200, + "toJsonRetval", + 300 + ] +} +jx +{lf:"toJsonRetval",nf:"toJsonRetval",array:[100,"toJsonRetval",200,"toJsonRetval",300]} +{ + lf: "toJsonRetval", + nf: "toJsonRetval", + array: [ + 100, + "toJsonRetval", + 200, + "toJsonRetval", + 300 + ] +} +jc +{"lf":"toJsonRetval","nf":"toJsonRetval","array":[100,"toJsonRetval",200,"toJsonRetval",300]} +{ + "lf": "toJsonRetval", + "nf": "toJsonRetval", + "array": [ + 100, + "toJsonRetval", + 200, + "toJsonRetval", + 300 + ] +} +json +0 +0 +jx +0 +0 +jc +0 +0 +json +0 +0 +jx +0 +0 +jc +0 +0 +json +{"lf":null,"nf":null,"array":[100,1,200,3,300]} +{ + "lf": null, + "nf": null, + "array": [ + 100, + 1, + 200, + 3, + 300 + ] +} +jx +{lf:NaN,nf:NaN,array:[100,1,200,3,300]} +{ + lf: NaN, + nf: NaN, + array: [ + 100, + 1, + 200, + 3, + 300 + ] +} +jc +{"lf":{"_nan":true},"nf":{"_nan":true},"array":[100,1,200,3,300]} +{ + "lf": {"_nan":true}, + "nf": {"_nan":true}, + "array": [ + 100, + 1, + 200, + 3, + 300 + ] +} +bound function test +F: function max() {"native"} +F type tag: 6 +G: function bound max() {"bound"} +G type tag: 6 +G.length: 1 +H: function bound bound max() {"bound"} +H type tag: 6 +H.length: 0 +I: function bound bound bound max() {"bound"} +I type tag: 6 +I.length: 0 +G(123): 234 +G(123,987): 987 +property get test +length directly: 2 +toString coerced object (return "length") +objLengthKey coerced to string: length +toString coerced object (return "length") +length through object coercion: 2 +read from length -> 2 +read from prototype -> undefined +read from name -> max +toString coerced object (return "length") +toString coerced object (return "length") +read from length -> 2 +read from testWritable -> 123 +read from testNonWritable -> 234 +read from call -> function call() {"native"} +read from apply -> function apply() {"native"} +read from nonexistent -> 123 +property put test +write to length -> silent error +write to prototype -> silent error +write to name -> silent error +toString coerced object (return "length") +toString coerced object (return "length") +write to length -> silent error +write to testWritable -> silent error +write to testNonWritable -> silent error +write to call -> silent error +write to apply -> silent error +write to nonexistent -> silent error +write to length -> TypeError +never here: prototype +write to name -> TypeError +toString coerced object (return "length") +toString coerced object (return "length") +write to length -> TypeError +never here: testWritable +write to testNonWritable -> TypeError +never here: call +never here: apply +never here: nonexistent +property has test +existence: length -> true +existence: prototype -> true +existence: name -> true +toString coerced object (return "length") +toString coerced object (return "length") +existence: length -> true +existence: testWritable -> true +existence: testNonWritable -> true +existence: call -> true +existence: apply -> true +existence: nonexistent -> true +property delete test +delete: length -> false +delete: prototype -> true +delete: name -> false +toString coerced object (return "length") +toString coerced object (return "length") +delete: length -> false +delete: testWritable -> true +delete: testNonWritable -> true +delete: call -> true +delete: apply -> true +delete: nonexistent -> true +delete: length -> TypeError +delete: prototype -> true +delete: name -> TypeError +toString coerced object (return "length") +toString coerced object (return "length") +delete: length -> TypeError +delete: testWritable -> true +delete: testNonWritable -> true +delete: call -> true +delete: apply -> true +delete: nonexistent -> true +non-strict: true +strict: true +property accessor this binding test +getter, strict +strict getter "this" binding test +typeof this: function +this == lightFunc: true +this === lightFunc: true +this.name: max +type tag: 6 +getter retval +setter, strict +strict setter "this" binding test +typeof this: function +this == lightFunc: true +this === lightFunc: true +this.name: max +type tag: 6 +getter, non-strict +non-strict getter "this" binding test +typeof this: function +this == lightFunc: true +this === lightFunc: true +this.name: max +type tag: 6 +getter retval +setter, non-strict +non-strict setter "this" binding test +typeof this: function +this == lightFunc: true +this === lightFunc: true +this.name: max +type tag: 6 +property misc test +isSealed: false +isFrozen: false +isExtensible: true +for-in: "inheritTestProperty" +Object.getOwnPropertyNames: "length" +Object.getOwnPropertyNames: "name" +lightFunc.name matches regexp: false +censored lightFunc.name: max_ +traceback test +URIError: invalid input + at [anon] (duk_bi_global.c:NNN) internal + at decodeURIComponent () native strict preventsyield + at tracebackTest (TESTCASE:NNN) + at global (TESTCASE:NNN) preventsyield +Duktape.act() test +Error: for traceback + at callback (TESTCASE:NNN) preventsyield + at forEach () native strict preventsyield + at duktapeActTest (TESTCASE:NNN) + at global (TESTCASE:NNN) preventsyield +-1 ["lineNumber","pc","function"] act +-2 ["lineNumber","pc","function"] callback +-3 ["lineNumber","pc","function"] forEach +-4 ["lineNumber","pc","function"] duktapeActTest +-5 ["lineNumber","pc","function"] global +exempt built-ins test +Math.max (is lightfunc): function false +eval: function false +yield: function false +resume: function false +require: function false +Object: function false +Function: function false +Array: function false +String: function false +Boolean: function false +Number: function false +Date: function false +RegExp: function false +Error: function false +EvalError: function false +RangeError: function false +ReferenceError: function false +SyntaxError: function false +TypeError: function false +URIError: function false +Proxy: function false +Duktape.Pointer: function false +Duktape.Thread: function false +Duktape.Logger: function false +Duktape: object false +Math: object false +JSON: object false +getOwnPropertyNames() test +length,name +length +name +getOwnPropertyDescriptor() test +key: name +value: string cos +writable: boolean false +enumerable: boolean false +configurable: boolean false +key: length +value: number 1 +writable: boolean false +enumerable: boolean false +configurable: boolean false +key: nonExistent +no descriptor +hasOwnProperty() test +true +true +false +false +propertyIsEnumerable() test +false +false +false +false +defineProperty() test +nonexistent: success +name: TypeError +length: success +defineProperties() test +nonexistent: success +name: TypeError +length: success +getPrototypeOf() test +true +true +setPrototypeOf() test +TypeError +never here +TypeError +never here +success +success +success +success +Array built-in test +Array: object [{_func:true}] +new Array: object [{_func:true}] +isArray: boolean false +toString: string "[object Function]" +valueOf: function {_func:true} +concat: object [{_func:true}] +pop: TypeError +push: TypeError +sort: function {_func:true} +splice: TypeError +reverse: function {_func:true} +shift: TypeError +unshift: TypeError +every: TypeError +some: TypeError +forEach: TypeError +map: TypeError +filter: TypeError +reduce: TypeError +reduceRight: TypeError +Boolean built-in test +Boolean: boolean true +new Boolean: object true +toString: TypeError +valueOf: TypeError +Duktape.Buffer built-in test +Duktape.Buffer: TypeError +new Duktape.buffer: TypeError +toString: TypeError +valueOf: TypeError +Date built-in test +Date: string "string" +new Date: string "object" +parse: number NaN +UTC: number NaN +now: string "number" +toString: TypeError +valueOf: TypeError +toDateString: TypeError +toTimeString: TypeError +toLocaleString: TypeError +toLocaleDateString: TypeError +toLocaleTimeString: TypeError +getTime: TypeError +getFullYear: TypeError +getUTCFullYear: TypeError +getMonth: TypeError +getUTCFullMonth: TypeError +getDate: TypeError +getUTCDate: TypeError +getDay: TypeError +getUTCDay: TypeError +getHours: TypeError +getUTCHours: TypeError +getMinutes: TypeError +getUTCMinutes: TypeError +getSeconds: TypeError +getUTCSeconds: TypeError +getMilliseconds: TypeError +getUTCMilliseconds: TypeError +getTimezoneOffset: TypeError +setTime: TypeError +setMilliseconds: TypeError +setUTCMilliseconds: TypeError +setSeconds: TypeError +setUTCSeconds: TypeError +setMinutes: TypeError +setUTCMinutes: TypeError +setHours: TypeError +setUTCHours: TypeError +setDate: TypeError +setUTCDate: TypeError +setMonth: TypeError +setUTCMonth: TypeError +setFullYear: TypeError +setUTCFullYear: TypeError +toUTCString: TypeError +toISOString: TypeError +toJSON: TypeError +setYear: TypeError +getYear: TypeError +Duktape built-in test +info: number 6 +act: undefined undefined +gc: boolean true +fin-get: undefined undefined +fin-set: undefined undefined +encdec-hex: string "function cos() {\"native\"}" +dec-hex: TypeError +compact: function {_func:true} +Error built-in test +Error: object {} +new Error: object {} +toString: string "cos" +valueOf: function {_func:true} +Function built-in test +Function: function {_func:true} +new Function: function {_func:true} +toString: string "function cos() {\"native\"}" +valueOf: function {_func:true} +global built-in test +eval: function {_func:true} +parseInt: number NaN +parseFloat: number NaN +isNaN: boolean true +isFinite: boolean false +decodeURI: string "function cos() {\"native\"}" +decodeURIComponent: string "function cos() {\"native\"}" +encodeURI: string "string" +encodeURIComponent: string "string" +escape: string "string" +unescape: string "string" +JSON built-in test +parse: SyntaxError +stringify: undefined undefined +Duktape.Logger built-in test +Duktape.Logger: TypeError +new Duktape.Logger: object {} +fmt: TypeError +raw: TypeError +TIMESTAMP INF test: My light func is: function cos() {"native"} +Math built-in test +abs: number NaN +acos: number NaN +asin: number NaN +atan: number NaN +atan2: number NaN +ceil: number NaN +cos: number NaN +exp: number NaN +floor: number NaN +log: number NaN +max: number NaN +min: number NaN +pow: number NaN +random: string "number" +round: number NaN +sin: number NaN +sqrt: number NaN +tan: number NaN +Number built-in test +Number: number NaN +new Number: object NaN +toString: TypeError +toLocaleString: TypeError +valueOf: TypeError +toFixed: TypeError +toExponential: TypeError +toPrecision: TypeError +Object built-in test +Object: function {_func:true} +new Object: function {_func:true} +getPrototypeOf: function {_func:true} +setPrototypeOf: function {_func:true} +seal: function {_func:true} +freeze: function {_func:true} +preventExtensions: function {_func:true} +isSealed: boolean true +isFrozen: boolean true +isExtensible: boolean false +toString: string "[object Function]" +toLocaleString: string "[object Function]" +valueOf: function {_func:true} +isPrototypeOf: boolean false +Duktape.Pointer built-in test +false +false +toString: TypeError +valueOf: TypeError +Proxy built-in test +get +this: object false [object Object] +target: function false [object Function] +key: string name +proxy.name: cos +get +this: object false [object Object] +target: function false [object Function] +key: string length +proxy.length: 1 +get +this: object false [object Object] +target: function false [object Function] +key: string nonExistent +proxy.nonExistent: dummy +proxy.foo: bar +proxy.nonExistent: undefined +RegExp built-in test +RegExp: object {} +new RegExp: object {} +exec: TypeError +test: TypeError +toString: TypeError +valueOf: function {_func:true} +String built-in test +String: string "[object Function]" +new String: string "[object Function]" +new String: string "object" +fromCharCode: string "\x00" +toString: TypeError +valueOf: TypeError +charAt: string "[" +charCodeAt: number 91 +concat: string "[object Function][object Function]" +indexOf: number 0 +lastIndexOf: number 0 +localeCompare: number 0 +match: object ["o"] +replace: string "undefined" +search: number 1 +slice: string "[object Function]" +split: object ["",""] +substring: string "[object Function]" +toLowerCase: string "[object function]" +toLocaleLowerCase: string "[object function]" +toUpperCase: string "[OBJECT FUNCTION]" +toLocaleUpperCase: string "[OBJECT FUNCTION]" +trim: string "[object Function]" +substr: string "[object Function]" +Duktape.Thread built-in test +TypeError +TypeError +Object .valueOf() test +true +function function +true +6 +6 diff --git a/tests/knownissues/test-dev-lightfunc-3.txt b/tests/knownissues/test-dev-lightfunc-3.txt new file mode 100644 index 00000000..e128432c --- /dev/null +++ b/tests/knownissues/test-dev-lightfunc-3.txt @@ -0,0 +1,750 @@ +summary: requires DUK_USE_LIGHTFUNC_BUILTINS +--- +light func support test +info.length: 9 +typeof: function +6 +typeof test +function +property assignment test +strPlainNonStrict: success +strPlainStrict: TypeError +strObjectNonStrict: success +strObjectStrict: success +strObjectNonextNonStrict: success +strObjectNonextStrict: TypeError +lfuncNonStrict1: success +lfuncNonStrict2: success +lfuncStrict1: TypeError +lfuncStrict2: success +instanceof test +{} instanceof lightfunc: TypeError +false +{} instanceof func-wo-prototype: TypeError +lightFunc instanceof Function: true +lightFunc instanceof Number: false +lightFunc instanceof Object: true +comparison test +0 0 true true +0 1 false false +0 2 false false +0 3 true true +0 4 false false +0 5 false false +0 6 false false +1 0 false false +1 1 true true +1 2 false false +1 3 false false +1 4 true true +1 5 false false +1 6 false false +2 0 false false +2 1 false false +2 2 true true +2 3 false false +2 4 false false +2 5 true true +2 6 false false +3 0 true true +3 1 false false +3 2 false false +3 3 true true +3 4 false false +3 5 false false +3 6 false false +4 0 false false +4 1 true true +4 2 false false +4 3 false false +4 4 true true +4 5 false false +4 6 false false +5 0 false false +5 1 false false +5 2 true true +5 3 false false +5 4 false false +5 5 true true +5 6 false false +6 0 false false +6 1 false false +6 2 false false +6 3 false false +6 4 false false +6 5 false false +6 6 true true +arithmetic test +string: testfunction cos() { [native code] }function sin() { [native code] } +string: function cos() { [native code] }function sin() { [native code] } +string: function foo() { [ecmascript code] }function bar() { [ecmascript code] } +toString() test +function max() { [native code] } +function max() { [native code] } +function max() { [native code] } +true +true +toObject() test +caching: true +length: 2 2 +name: max max +typeof: function function +internal prototype is Function.prototype: true true +external prototype is not set: true +internal prototypes match: true +external prototypes match (do not exist): true +isExtensible: true true +Math.max test: 9 9 +length: 1 1 +toBoolean() test +true +true +toBuffer() test +object: function cos() { [native code] } +object: function sin() { [native code] } +toPointer() test +pointer false +object false +number coercion test +NaN +NaN +0 +0 +0 +0 +0 +0 +call and apply test +call +321 +apply +987 +this coercion test +function false +function false +inherit from Function.prototype test +testValue +Object.prototype.toString() test +[object Function] +JSON/JX/JC test +json +undefined +undefined +jx +{_func:true} +{_func:true} +jc +{"_func":true} +{"_func":true} +json +undefined +undefined +jx +{_func:true} +{_func:true} +jc +{"_func":true} +{"_func":true} +json +{"array":[100,null,200,null,300]} +{ + "array": [ + 100, + null, + 200, + null, + 300 + ] +} +jx +{lf:{_func:true},nf:{_func:true},array:[100,{_func:true},200,{_func:true},300]} +{ + lf: {_func:true}, + nf: {_func:true}, + array: [ + 100, + {_func:true}, + 200, + {_func:true}, + 300 + ] +} +jc +{"lf":{"_func":true},"nf":{"_func":true},"array":[100,{"_func":true},200,{"_func":true},300]} +{ + "lf": {"_func":true}, + "nf": {"_func":true}, + "array": [ + 100, + {"_func":true}, + 200, + {"_func":true}, + 300 + ] +} +json +"toJsonRetval" +"toJsonRetval" +jx +"toJsonRetval" +"toJsonRetval" +jc +"toJsonRetval" +"toJsonRetval" +json +"toJsonRetval" +"toJsonRetval" +jx +"toJsonRetval" +"toJsonRetval" +jc +"toJsonRetval" +"toJsonRetval" +json +{"lf":"toJsonRetval","nf":"toJsonRetval","array":[100,"toJsonRetval",200,"toJsonRetval",300]} +{ + "lf": "toJsonRetval", + "nf": "toJsonRetval", + "array": [ + 100, + "toJsonRetval", + 200, + "toJsonRetval", + 300 + ] +} +jx +{lf:"toJsonRetval",nf:"toJsonRetval",array:[100,"toJsonRetval",200,"toJsonRetval",300]} +{ + lf: "toJsonRetval", + nf: "toJsonRetval", + array: [ + 100, + "toJsonRetval", + 200, + "toJsonRetval", + 300 + ] +} +jc +{"lf":"toJsonRetval","nf":"toJsonRetval","array":[100,"toJsonRetval",200,"toJsonRetval",300]} +{ + "lf": "toJsonRetval", + "nf": "toJsonRetval", + "array": [ + 100, + "toJsonRetval", + 200, + "toJsonRetval", + 300 + ] +} +json +0 +0 +jx +0 +0 +jc +0 +0 +json +0 +0 +jx +0 +0 +jc +0 +0 +json +{"lf":null,"nf":null,"array":[100,1,200,3,300]} +{ + "lf": null, + "nf": null, + "array": [ + 100, + 1, + 200, + 3, + 300 + ] +} +jx +{lf:NaN,nf:NaN,array:[100,1,200,3,300]} +{ + lf: NaN, + nf: NaN, + array: [ + 100, + 1, + 200, + 3, + 300 + ] +} +jc +{"lf":{"_nan":true},"nf":{"_nan":true},"array":[100,1,200,3,300]} +{ + "lf": {"_nan":true}, + "nf": {"_nan":true}, + "array": [ + 100, + 1, + 200, + 3, + 300 + ] +} +bound function test +F: function max() { [native code] } +F type tag: 6 +G: function bound max() { [bound code] } +G type tag: 6 +G.length: 1 +H: function bound bound max() { [bound code] } +H type tag: 6 +H.length: 0 +I: function bound bound bound max() { [bound code] } +I type tag: 6 +I.length: 0 +G(123): 234 +G(123,987): 987 +property get test +length directly: 2 +toString coerced object (return "length") +objLengthKey coerced to string: length +toString coerced object (return "length") +length through object coercion: 2 +read from length -> 2 +read from prototype -> undefined +read from name -> max +toString coerced object (return "length") +toString coerced object (return "length") +read from length -> 2 +read from testWritable -> 123 +read from testNonWritable -> 234 +read from call -> function call() { [native code] } +read from apply -> function apply() { [native code] } +read from nonexistent -> 123 +property put test +write to length -> silent error +write to prototype -> silent error +write to name -> silent error +toString coerced object (return "length") +toString coerced object (return "length") +write to length -> silent error +write to testWritable -> silent error +write to testNonWritable -> silent error +write to call -> silent error +write to apply -> silent error +write to nonexistent -> silent error +write to length -> TypeError +never here: prototype +write to name -> TypeError +toString coerced object (return "length") +toString coerced object (return "length") +write to length -> TypeError +never here: testWritable +write to testNonWritable -> TypeError +never here: call +never here: apply +never here: nonexistent +property has test +existence: length -> true +existence: prototype -> true +existence: name -> true +toString coerced object (return "length") +toString coerced object (return "length") +existence: length -> true +existence: testWritable -> true +existence: testNonWritable -> true +existence: call -> true +existence: apply -> true +existence: nonexistent -> true +property delete test +delete: length -> false +delete: prototype -> true +delete: name -> false +toString coerced object (return "length") +toString coerced object (return "length") +delete: length -> false +delete: testWritable -> true +delete: testNonWritable -> true +delete: call -> true +delete: apply -> true +delete: nonexistent -> true +delete: length -> TypeError +delete: prototype -> true +delete: name -> TypeError +toString coerced object (return "length") +toString coerced object (return "length") +delete: length -> TypeError +delete: testWritable -> true +delete: testNonWritable -> true +delete: call -> true +delete: apply -> true +delete: nonexistent -> true +non-strict: true +strict: true +property accessor this binding test +getter, strict +strict getter "this" binding test +typeof this: function +this == lightFunc: true +this === lightFunc: true +this.name: max +type tag: 6 +getter retval +setter, strict +strict setter "this" binding test +typeof this: function +this == lightFunc: true +this === lightFunc: true +this.name: max +type tag: 6 +getter, non-strict +non-strict getter "this" binding test +typeof this: function +this == lightFunc: true +this === lightFunc: true +this.name: max +type tag: 6 +getter retval +setter, non-strict +non-strict setter "this" binding test +typeof this: function +this == lightFunc: true +this === lightFunc: true +this.name: max +type tag: 6 +property misc test +isSealed: false +isFrozen: false +isExtensible: true +for-in: "inheritTestProperty" +Object.getOwnPropertyNames: "length" +Object.getOwnPropertyNames: "name" +lightFunc.name matches regexp: false +censored lightFunc.name: max_ +traceback test +URIError: invalid input + at [anon] (duk_bi_global.c:NNN) internal + at decodeURIComponent () native strict preventsyield + at tracebackTest (TESTCASE:NNN) + at global (TESTCASE:NNN) preventsyield +Duktape.act() test +Error: for traceback + at callback (TESTCASE:NNN) preventsyield + at forEach () native strict preventsyield + at duktapeActTest (TESTCASE:NNN) + at global (TESTCASE:NNN) preventsyield +-1 ["lineNumber","pc","function"] act +-2 ["lineNumber","pc","function"] callback +-3 ["lineNumber","pc","function"] forEach +-4 ["lineNumber","pc","function"] duktapeActTest +-5 ["lineNumber","pc","function"] global +exempt built-ins test +Math.max (is lightfunc): function false +eval: function false +yield: function false +resume: function false +require: function false +Object: function false +Function: function false +Array: function false +String: function false +Boolean: function false +Number: function false +Date: function false +RegExp: function false +Error: function false +EvalError: function false +RangeError: function false +ReferenceError: function false +SyntaxError: function false +TypeError: function false +URIError: function false +Proxy: function false +Duktape.Pointer: function false +Duktape.Thread: function false +Duktape.Logger: function false +Duktape: object false +Math: object false +JSON: object false +getOwnPropertyNames() test +length,name +length +name +getOwnPropertyDescriptor() test +key: name +value: string cos +writable: boolean false +enumerable: boolean false +configurable: boolean false +key: length +value: number 1 +writable: boolean false +enumerable: boolean false +configurable: boolean false +key: nonExistent +no descriptor +hasOwnProperty() test +true +true +false +false +propertyIsEnumerable() test +false +false +false +false +defineProperty() test +nonexistent: success +name: TypeError +length: success +defineProperties() test +nonexistent: success +name: TypeError +length: success +getPrototypeOf() test +true +true +setPrototypeOf() test +TypeError +never here +TypeError +never here +success +success +success +success +Array built-in test +Array: object [{_func:true}] +new Array: object [{_func:true}] +isArray: boolean false +toString: string "[object Function]" +valueOf: function {_func:true} +concat: object [{_func:true}] +pop: TypeError +push: TypeError +sort: function {_func:true} +splice: TypeError +reverse: function {_func:true} +shift: TypeError +unshift: TypeError +every: TypeError +some: TypeError +forEach: TypeError +map: TypeError +filter: TypeError +reduce: TypeError +reduceRight: TypeError +Boolean built-in test +Boolean: boolean true +new Boolean: object true +toString: TypeError +valueOf: TypeError +Duktape.Buffer built-in test +Duktape.Buffer: TypeError +new Duktape.buffer: TypeError +toString: TypeError +valueOf: TypeError +Date built-in test +Date: string "string" +new Date: string "object" +parse: number NaN +UTC: number NaN +now: string "number" +toString: TypeError +valueOf: TypeError +toDateString: TypeError +toTimeString: TypeError +toLocaleString: TypeError +toLocaleDateString: TypeError +toLocaleTimeString: TypeError +getTime: TypeError +getFullYear: TypeError +getUTCFullYear: TypeError +getMonth: TypeError +getUTCFullMonth: TypeError +getDate: TypeError +getUTCDate: TypeError +getDay: TypeError +getUTCDay: TypeError +getHours: TypeError +getUTCHours: TypeError +getMinutes: TypeError +getUTCMinutes: TypeError +getSeconds: TypeError +getUTCSeconds: TypeError +getMilliseconds: TypeError +getUTCMilliseconds: TypeError +getTimezoneOffset: TypeError +setTime: TypeError +setMilliseconds: TypeError +setUTCMilliseconds: TypeError +setSeconds: TypeError +setUTCSeconds: TypeError +setMinutes: TypeError +setUTCMinutes: TypeError +setHours: TypeError +setUTCHours: TypeError +setDate: TypeError +setUTCDate: TypeError +setMonth: TypeError +setUTCMonth: TypeError +setFullYear: TypeError +setUTCFullYear: TypeError +toUTCString: TypeError +toISOString: TypeError +toJSON: TypeError +setYear: TypeError +getYear: TypeError +Duktape built-in test +info: number 6 +act: undefined undefined +gc: boolean true +fin-get: undefined undefined +fin-set: undefined undefined +encdec-hex: string "function cos() { [native code] }" +dec-hex: TypeError +compact: function {_func:true} +Error built-in test +Error: object {} +new Error: object {} +toString: string "cos" +valueOf: function {_func:true} +Function built-in test +Function: SyntaxError +new Function: SyntaxError +toString: string "function cos() { [native code] }" +valueOf: function {_func:true} +global built-in test +eval: function {_func:true} +parseInt: number NaN +parseFloat: number NaN +isNaN: boolean true +isFinite: boolean false +decodeURI: string "function cos() { [native code] }" +decodeURIComponent: string "function cos() { [native code] }" +encodeURI: string "string" +encodeURIComponent: string "string" +escape: string "string" +unescape: string "string" +JSON built-in test +parse: SyntaxError +stringify: undefined undefined +Duktape.Logger built-in test +Duktape.Logger: TypeError +new Duktape.Logger: object {} +fmt: TypeError +raw: TypeError +TIMESTAMP INF test: My light func is: function cos() { [native code] } +Math built-in test +abs: number NaN +acos: number NaN +asin: number NaN +atan: number NaN +atan2: number NaN +ceil: number NaN +cos: number NaN +exp: number NaN +floor: number NaN +log: number NaN +max: number NaN +min: number NaN +pow: number NaN +random: string "number" +round: number NaN +sin: number NaN +sqrt: number NaN +tan: number NaN +Number built-in test +Number: number NaN +new Number: object NaN +toString: TypeError +toLocaleString: TypeError +valueOf: TypeError +toFixed: TypeError +toExponential: TypeError +toPrecision: TypeError +Object built-in test +Object: function {_func:true} +new Object: function {_func:true} +getPrototypeOf: function {_func:true} +setPrototypeOf: function {_func:true} +seal: function {_func:true} +freeze: function {_func:true} +preventExtensions: function {_func:true} +isSealed: boolean true +isFrozen: boolean true +isExtensible: boolean false +toString: string "[object Function]" +toLocaleString: string "[object Function]" +valueOf: function {_func:true} +isPrototypeOf: boolean false +Duktape.Pointer built-in test +false +false +toString: TypeError +valueOf: TypeError +Proxy built-in test +get +this: object false [object Object] +target: function false [object Function] +key: string name +proxy.name: cos +get +this: object false [object Object] +target: function false [object Function] +key: string length +proxy.length: 1 +get +this: object false [object Object] +target: function false [object Function] +key: string nonExistent +proxy.nonExistent: dummy +proxy.foo: bar +proxy.nonExistent: undefined +RegExp built-in test +RegExp: object {} +new RegExp: object {} +exec: TypeError +test: TypeError +toString: TypeError +valueOf: function {_func:true} +String built-in test +String: string "[object Function]" +new String: string "[object Function]" +new String: string "object" +fromCharCode: string "\x00" +toString: TypeError +valueOf: TypeError +charAt: string "[" +charCodeAt: number 91 +concat: string "[object Function][object Function]" +indexOf: number 0 +lastIndexOf: number 0 +localeCompare: number 0 +match: object ["o"] +replace: string "undefined" +search: number 1 +slice: string "[object Function]" +split: object ["",""] +substring: string "[object Function]" +toLowerCase: string "[object function]" +toLocaleLowerCase: string "[object function]" +toUpperCase: string "[OBJECT FUNCTION]" +toLocaleUpperCase: string "[OBJECT FUNCTION]" +trim: string "[object Function]" +substr: string "[object Function]" +Duktape.Thread built-in test +TypeError +TypeError +Object .valueOf() test +true +function function +true +6 +6