[njs] Fixed typo introduced in db77713e0536.
Dmitry Volyntsev
xeioex at nginx.com
Tue Jun 2 15:18:06 UTC 2020
details: https://hg.nginx.org/njs/rev/13e36f31e331
branches:
changeset: 1416:13e36f31e331
user: Dmitry Volyntsev <xeioex at nginx.com>
date: Tue Jun 02 14:59:27 2020 +0000
description:
Fixed typo introduced in db77713e0536.
diffstat:
src/njs_array.c | 2 +-
src/test/njs_unit_test.c | 9 +++++++++
2 files changed, 10 insertions(+), 1 deletions(-)
diffs (31 lines):
diff -r 4117ec04714b -r 13e36f31e331 src/njs_array.c
--- a/src/njs_array.c Tue Jun 02 17:53:29 2020 +0300
+++ b/src/njs_array.c Tue Jun 02 14:59:27 2020 +0000
@@ -1361,7 +1361,7 @@ njs_array_prototype_reverse(njs_vm_t *vm
array->start[l] = hvalue;
} else {
- array->start[h] = njs_value_invalid;
+ array->start[l] = njs_value_invalid;
}
} else if (hret == NJS_OK) {
diff -r 4117ec04714b -r 13e36f31e331 src/test/njs_unit_test.c
--- a/src/test/njs_unit_test.c Tue Jun 02 17:53:29 2020 +0300
+++ b/src/test/njs_unit_test.c Tue Jun 02 14:59:27 2020 +0000
@@ -4504,6 +4504,15 @@ static njs_unit_test_t njs_test[] =
{ njs_str("var a = [1,2,3,4]; a.reverse()"),
njs_str("4,3,2,1") },
+ { njs_str("[1,2,3,,,].reverse()"),
+ njs_str(",,3,2,1") },
+
+ { njs_str("[,2,3,,,].reverse()"),
+ njs_str(",,3,2,") },
+
+ { njs_str("[,,,3,2,1].reverse()"),
+ njs_str("1,2,3,,,") },
+
{ njs_str("var o = {1:true, 2:'', length:-2}; Array.prototype.reverse.call(o) === o"),
njs_str("true") },
More information about the nginx-devel
mailing list