From: Igor Sysoev Date: Tue, 21 Mar 2017 13:09:09 +0000 (+0300) Subject: The undefined values must be equal. X-Git-Tag: 0.1.10~22 X-Git-Url: http://www.kaiwu.me/postgresql/commit/?a=commitdiff_plain;h=9c932e0a6f09422be9073e8fbb4ffea776864631;p=njs.git The undefined values must be equal. --- diff --git a/njs/njs_vm.c b/njs/njs_vm.c index ecb61b43..a07daa54 100644 --- a/njs/njs_vm.c +++ b/njs/njs_vm.c @@ -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); } diff --git a/njs/test/njs_unit_test.c b/njs/test/njs_unit_test.c index c4d7ed0d..b01576ec 100644 --- a/njs/test/njs_unit_test.c +++ b/njs/test/njs_unit_test.c @@ -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") },