[njs] Improved array allocation test for low memory machines.

Alexander Borisov alexander.borisov at nginx.com
Mon Apr 22 15:06:51 UTC 2019


details:   https://hg.nginx.org/njs/rev/72252310ae3f
branches:  
changeset: 916:72252310ae3f
user:      Alexander Borisov <alexander.borisov at nginx.com>
date:      Mon Apr 22 18:06:17 2019 +0300
description:
Improved array allocation test for low memory machines.

diffstat:

 njs/test/njs_unit_test.c |  10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diffs (20 lines):

diff -r 3869b6e1f296 -r 72252310ae3f njs/test/njs_unit_test.c
--- a/njs/test/njs_unit_test.c	Sun Apr 21 17:36:25 2019 +0800
+++ b/njs/test/njs_unit_test.c	Mon Apr 22 18:06:17 2019 +0300
@@ -7977,13 +7977,9 @@ static njs_unit_test_t  njs_test[] =
     { nxt_string("var x = Array(2**28)"),
       nxt_string("MemoryError") },
 
-    { nxt_string("var r; try {"
-                 "    var x = Array(2**27), y = Array(2**5).fill(x);"
-                 "    Array.prototype.concat.apply(y[0], y.slice(1));"
-                 "} catch (e) {"
-                 "    r = e.name == 'InternalError' || e.name == 'RangeError'"
-                 "} r"),
-      nxt_string("true") },
+    { nxt_string("var x = Array(2**20), y = Array(2**12).fill(x);"
+                 "Array.prototype.concat.apply(y[0], y.slice(1))"),
+      nxt_string("RangeError: Invalid array length") },
 
     { nxt_string("var a = new Array(3); a"),
       nxt_string(",,") },


More information about the nginx-devel mailing list