[njs] Added extra tests for assignment expression.

Dmitry Volyntsev xeioex at nginx.com
Sun Apr 28 12:17:17 UTC 2019


details:   https://hg.nginx.org/njs/rev/9753a6388cb3
branches:  
changeset: 937:9753a6388cb3
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Sun Apr 28 14:56:33 2019 +0300
description:
Added extra tests for assignment expression.

This closes #52 issue on Github.

diffstat:

 njs/test/njs_unit_test.c |  8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diffs (18 lines):

diff -r 2f1f71863953 -r 9753a6388cb3 njs/test/njs_unit_test.c
--- a/njs/test/njs_unit_test.c	Sat Apr 27 09:04:24 2019 +0800
+++ b/njs/test/njs_unit_test.c	Sun Apr 28 14:56:33 2019 +0300
@@ -4975,6 +4975,14 @@ static njs_unit_test_t  njs_test[] =
                  "          valueOf: function() { return 1 } };  a"),
       nxt_string("1") },
 
+    { nxt_string("var a = { toString: function() { return [] },"
+                 "          valueOf: function() { return 1 } };"
+                 "var o = {}; o[a] = 'test'"),
+      nxt_string("test") },
+
+    { nxt_string("({})[{}] = 'test'"),
+      nxt_string("test") },
+
     { nxt_string("var o = {b:$r.props.b}; o.b"),
       nxt_string("42") },
 


More information about the nginx-devel mailing list