mirror of https://github.com/svaarala/duktape.git
Sami Vaarala
11 years ago
2 changed files with 70 additions and 0 deletions
@ -0,0 +1,37 @@ |
|||
/* |
|||
* Large literals use up a lot of constants and even quite |
|||
* reasonable literals currently cause an "out of consts" |
|||
* error. |
|||
*/ |
|||
|
|||
/*=== |
|||
test 1 ok |
|||
test 2 ok |
|||
test 3 ok |
|||
===*/ |
|||
|
|||
function test(n) { |
|||
var src = ''; |
|||
|
|||
src += '(function () {'; |
|||
src += 'var obj = {'; |
|||
for (i = 0; i < n; i++) { |
|||
if (i > 0) { src += ', '; } |
|||
src += 'key' + i + ': ' + '"val' + i + '"'; |
|||
} |
|||
src += '}; })'; |
|||
|
|||
eval(src); |
|||
} |
|||
|
|||
try { |
|||
test(100); |
|||
print('test 1 ok'); |
|||
test(200); |
|||
print('test 2 ok'); |
|||
test(10000); |
|||
print('test 3 ok'); |
|||
} catch (e) { |
|||
print(e); |
|||
} |
|||
|
@ -0,0 +1,33 @@ |
|||
/* |
|||
* Test limits on inner functions. |
|||
*/ |
|||
|
|||
/*=== |
|||
test 1 ok |
|||
test 2 ok |
|||
test 3 ok |
|||
===*/ |
|||
|
|||
function test(n) { |
|||
var src = ''; |
|||
|
|||
src += '(function () {'; |
|||
for (i = 0; i < n; i++) { |
|||
src += 'function innerfunc' + i + '() {} '; |
|||
} |
|||
src += '})'; |
|||
|
|||
eval(src); |
|||
} |
|||
|
|||
try { |
|||
test(100); |
|||
print('test 1 ok'); |
|||
test(200); |
|||
print('test 2 ok'); |
|||
test(10000); |
|||
print('test 3 ok'); |
|||
} catch (e) { |
|||
print(e); |
|||
} |
|||
|
Loading…
Reference in new issue