Fix assertion 'bytes_copied > 0' in JSON.stringify()

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs.u-szeged@partner.samsung.com
This commit is contained in:
Roland Takacs
2015-07-14 12:10:20 +02:00
committed by Evgeny Gavrin
parent 7ccec19c26
commit 292d99ba4e
2 changed files with 3 additions and 1 deletions
@@ -1129,7 +1129,7 @@ ecma_builtin_json_quote (ecma_string_t *string_p) /**< string that should be quo
ssize_t bytes_copied = ecma_string_to_utf8_string (string_p,
zt_string_buff,
(ssize_t) string_buf_size);
JERRY_ASSERT (bytes_copied > 0);
JERRY_ASSERT (bytes_copied > 0 || !string_len);
/* 2. */
for (ecma_length_t i = 0; i < string_len; i++)
+2
View File
@@ -14,6 +14,8 @@
// limitations under the License.
// Checking quoting strings
assert (JSON.stringify ("") === '""');
normal_string = "asdasd";
assert (JSON.stringify (normal_string) == '"asdasd"');