[njs] Fixed typo in njs_string_prototype_pad().
Dmitry Volyntsev
xeioex at nginx.com
Fri Nov 22 16:34:14 UTC 2019
details: https://hg.nginx.org/njs/rev/f98304d4019b
branches:
changeset: 1250:f98304d4019b
user: Artem S. Povalyukhin <artem.povaluhin at gmail.com>
date: Fri Nov 22 11:02:55 2019 +0300
description:
Fixed typo in njs_string_prototype_pad().
The typo was introduced in 47cdd4680fc2.
This closes #253 issue on Github.
diffstat:
src/njs_string.c | 2 +-
src/test/njs_unit_test.c | 6 ++++++
2 files changed, 7 insertions(+), 1 deletions(-)
diffs (35 lines):
diff -r 37f1f20de909 -r f98304d4019b src/njs_string.c
--- a/src/njs_string.c Thu Nov 21 22:31:14 2019 +0300
+++ b/src/njs_string.c Fri Nov 22 11:02:55 2019 +0300
@@ -2939,7 +2939,7 @@ njs_string_prototype_pad(njs_vm_t *vm, n
} else {
ret = njs_value_to_string(vm, pad, pad);
if (njs_slow_path(ret != NJS_OK)) {
- return NJS_OK;
+ return NJS_ERROR;
}
}
}
diff -r 37f1f20de909 -r f98304d4019b src/test/njs_unit_test.c
--- a/src/test/njs_unit_test.c Thu Nov 21 22:31:14 2019 +0300
+++ b/src/test/njs_unit_test.c Fri Nov 22 11:02:55 2019 +0300
@@ -6964,6 +6964,9 @@ static njs_unit_test_t njs_test[] =
{ njs_str("'абв'.padStart(10, 'эю')"),
njs_str("эюэюэюэабв") },
+ { njs_str("'abc'.padStart(10, Symbol())"),
+ njs_str("TypeError: Cannot convert a Symbol value to a string") },
+
{ njs_str("'1234'.padEnd(4)"),
njs_str("1234") },
@@ -7012,6 +7015,9 @@ static njs_unit_test_t njs_test[] =
{ njs_str("'абвг'.padEnd(10, 'ДЕЖЗ')"),
njs_str("абвгДЕЖЗДЕ") },
+ { njs_str("'abc'.padEnd(10, Symbol())"),
+ njs_str("TypeError: Cannot convert a Symbol value to a string") },
+
{ njs_str("String.bytesFrom({})"),
njs_str("TypeError: value must be a string or array") },
More information about the nginx-devel
mailing list