Welcome! Log In Create A New Profile

Advanced

[njs] The undefined values must be equal.

March 21, 2017 09:24AM
details: http://hg.nginx.org/njs/rev/ee391489a56d
branches:
changeset: 316:ee391489a56d
user: Igor Sysoev <igor@sysoev.ru>
date: Tue Mar 21 16:09:09 2017 +0300
description:
The undefined values must be equal.

diffstat:

njs/njs_vm.c | 7 ++++++-
njs/test/njs_unit_test.c | 18 +++++++++++++++---
2 files changed, 21 insertions(+), 4 deletions(-)

diffs (48 lines):

diff -r 9ee2a6eb381c -r ee391489a56d njs/njs_vm.c
--- a/njs/njs_vm.c Tue Mar 21 16:02:03 2017 +0300
+++ b/njs/njs_vm.c Tue Mar 21 16:09:09 2017 +0300
@@ -2046,7 +2046,12 @@ njs_values_strict_equal(const njs_value_
}

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);
}

diff -r 9ee2a6eb381c -r ee391489a56d njs/test/njs_unit_test.c
--- a/njs/test/njs_unit_test.c Tue Mar 21 16:02:03 2017 +0300
+++ b/njs/test/njs_unit_test.c Tue Mar 21 16:09:09 2017 +0300
@@ -1034,12 +1034,24 @@ static njs_unit_test_t njs_test[] =

/**/

+ { 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 < undefined"),
- nxt_string("false") },
-
{ nxt_string("undefined < false"),
nxt_string("false") },

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[njs] The undefined values must be equal.

Igor Sysoev 446 March 21, 2017 09:24AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 79
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready