Welcome! Log In Create A New Profile

Advanced

[njs] Fixed typo in njs_string_prototype_pad().

Dmitry Volyntsev
November 22, 2019 11:36AM
details: https://hg.nginx.org/njs/rev/f98304d4019b
branches:
changeset: 1250:f98304d4019b
user: Artem S. Povalyukhin <artem.povaluhin@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") },

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

[njs] Fixed typo in njs_string_prototype_pad().

Dmitry Volyntsev 84 November 22, 2019 11:36AM



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

Online Users

Guests: 96
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