]> git.kaiwu.me - njs.git/commitdiff
The undefined values must be equal.
authorIgor Sysoev <igor@sysoev.ru>
Tue, 21 Mar 2017 13:09:09 +0000 (16:09 +0300)
committerIgor Sysoev <igor@sysoev.ru>
Tue, 21 Mar 2017 13:09:09 +0000 (16:09 +0300)
njs/njs_vm.c
njs/test/njs_unit_test.c

index ecb61b43eb84bed8e3e4ccbe59b52d1897813a91..a07daa5446ee3ade581c158c3f36968db68527e1 100644 (file)
@@ -2046,7 +2046,12 @@ njs_values_strict_equal(const njs_value_t *val1, const njs_value_t *val2)
     }
 
     if (njs_is_numeric(val1)) {
-        /* NaNs and Infinities are handled correctly by comparision. */
+
+        if (val1->type == NJS_VOID) {
+            return 1;
+        }
+
+        /* Infinities are handled correctly by comparision. */
         return (val1->data.u.number == val2->data.u.number);
     }
 
index c4d7ed0dcf4fe8ffd6ccd27ee935e07b53e1264c..b01576ec3d40da2f380921938744442214020483 100644 (file)
@@ -1034,12 +1034,24 @@ static njs_unit_test_t  njs_test[] =
 
     /**/
 
-    { nxt_string("undefined < null"),
+    { nxt_string("undefined == undefined"),
+      nxt_string("true") },
+
+    { nxt_string("undefined != undefined"),
+      nxt_string("false") },
+
+    { nxt_string("undefined === undefined"),
+      nxt_string("true") },
+
+    { nxt_string("undefined !== undefined"),
       nxt_string("false") },
 
     { nxt_string("undefined < undefined"),
       nxt_string("false") },
 
+    { nxt_string("undefined < null"),
+      nxt_string("false") },
+
     { nxt_string("undefined < false"),
       nxt_string("false") },