2017-03-08 17:01:15 +00:00
|
|
|
// Copyright 2017 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
function TryParse(s, message) {
|
|
|
|
try {
|
|
|
|
JSON.parse(s);
|
|
|
|
assertUnreachable();
|
|
|
|
} catch(e) {
|
|
|
|
assertEquals(message, e.message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var s = `{"a\\\\b `;
|
2022-05-16 15:53:06 +00:00
|
|
|
TryParse(s, "Unterminated string in JSON at position 7");
|
2017-03-08 17:01:15 +00:00
|
|
|
|
|
|
|
var s = `{"a\\\\\u03A9 `;
|
2022-05-16 15:53:06 +00:00
|
|
|
TryParse(s, "Unterminated string in JSON at position 7");
|
2017-03-08 17:01:15 +00:00
|
|
|
|
|
|
|
var s = `{"ab `;
|
2022-05-16 15:53:06 +00:00
|
|
|
TryParse(s, "Unterminated string in JSON at position 5");
|
2017-03-08 17:01:15 +00:00
|
|
|
|
|
|
|
var s = `{"a\u03A9 `;
|
2022-05-16 15:53:06 +00:00
|
|
|
TryParse(s, "Unterminated string in JSON at position 5");
|
2017-03-08 17:01:15 +00:00
|
|
|
|
|
|
|
var s = `{"a\nb":"b"}`;
|
2022-05-18 16:12:47 +00:00
|
|
|
TryParse(s, "Bad control character in string literal in JSON at position 3");
|
2017-03-08 17:01:15 +00:00
|
|
|
|
|
|
|
var s = `{"a\nb":"b\u03A9"}`;
|
2022-05-18 16:12:47 +00:00
|
|
|
TryParse(s, "Bad control character in string literal in JSON at position 3");
|