mirror of
https://github.com/openjdk/jdk.git
synced 2026-07-28 03:43:21 +00:00
8166925: several native TESTs should be changed to TEST_VM
Reviewed-by: vlivanov, kzhaldyb
This commit is contained in:
parent
8240ee1cf0
commit
5650975427
@ -26,7 +26,7 @@
|
||||
#include "classfile/symbolTable.hpp"
|
||||
#include "unittest.hpp"
|
||||
|
||||
TEST(SymbolTable, temp_new_symbol) {
|
||||
TEST_VM(SymbolTable, temp_new_symbol) {
|
||||
// Assert messages assume these symbols are unique, and the refcounts start at
|
||||
// one, but code does not rely on this.
|
||||
JavaThread* THREAD = JavaThread::current();
|
||||
|
||||
@ -61,7 +61,7 @@ static bool is_described(const char* text) {
|
||||
return string_contains_substring(ss.as_string(), text);
|
||||
}
|
||||
|
||||
TEST_F(LogConfigurationTest, describe) {
|
||||
TEST_VM_F(LogConfigurationTest, describe) {
|
||||
ResourceMark rm;
|
||||
stringStream ss;
|
||||
LogConfiguration::describe(&ss);
|
||||
@ -115,7 +115,7 @@ TEST_F(LogConfigurationTest, describe) {
|
||||
}
|
||||
|
||||
// Test updating an existing log output
|
||||
TEST_F(LogConfigurationTest, update_output) {
|
||||
TEST_VM_F(LogConfigurationTest, update_output) {
|
||||
// Update stdout twice, first using it's name, and the second time its index #
|
||||
const char* test_outputs[] = { "stdout", "#0" };
|
||||
for (size_t i = 0; i < ARRAY_SIZE(test_outputs); i++) {
|
||||
@ -144,7 +144,7 @@ TEST_F(LogConfigurationTest, update_output) {
|
||||
}
|
||||
|
||||
// Test adding a new output to the configuration
|
||||
TEST_F(LogConfigurationTest, add_new_output) {
|
||||
TEST_VM_F(LogConfigurationTest, add_new_output) {
|
||||
const char* what = "all=trace";
|
||||
|
||||
ASSERT_FALSE(is_described(TestLogFileName));
|
||||
@ -160,7 +160,7 @@ TEST_F(LogConfigurationTest, add_new_output) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(LogConfigurationTest, disable_logging) {
|
||||
TEST_VM_F(LogConfigurationTest, disable_logging) {
|
||||
// Add TestLogFileName as an output
|
||||
set_log_config(TestLogFileName, "logging=info");
|
||||
|
||||
@ -185,7 +185,7 @@ TEST_F(LogConfigurationTest, disable_logging) {
|
||||
}
|
||||
|
||||
// Test disabling a particular output
|
||||
TEST_F(LogConfigurationTest, disable_output) {
|
||||
TEST_VM_F(LogConfigurationTest, disable_output) {
|
||||
// Disable the default configuration for stdout
|
||||
set_log_config("stdout", "all=off");
|
||||
|
||||
@ -213,7 +213,7 @@ TEST_F(LogConfigurationTest, disable_output) {
|
||||
}
|
||||
|
||||
// Test reconfiguration of the selected decorators for an output
|
||||
TEST_F(LogConfigurationTest, reconfigure_decorators) {
|
||||
TEST_VM_F(LogConfigurationTest, reconfigure_decorators) {
|
||||
// Configure stderr with all decorators
|
||||
set_log_config("stderr", "all=off", _all_decorators);
|
||||
char buf[256];
|
||||
@ -227,7 +227,7 @@ TEST_F(LogConfigurationTest, reconfigure_decorators) {
|
||||
}
|
||||
|
||||
// Test that invalid options cause configuration errors
|
||||
TEST_F(LogConfigurationTest, invalid_configure_options) {
|
||||
TEST_VM_F(LogConfigurationTest, invalid_configure_options) {
|
||||
LogConfiguration::disable_logging();
|
||||
const char* invalid_outputs[] = { "#2", "invalidtype=123", ":invalid/path}to*file?" };
|
||||
for (size_t i = 0; i < ARRAY_SIZE(invalid_outputs); i++) {
|
||||
@ -240,7 +240,7 @@ TEST_F(LogConfigurationTest, invalid_configure_options) {
|
||||
}
|
||||
|
||||
// Test empty configuration options
|
||||
TEST_F(LogConfigurationTest, parse_empty_command_line_arguments) {
|
||||
TEST_VM_F(LogConfigurationTest, parse_empty_command_line_arguments) {
|
||||
const char* empty_variations[] = { "", ":", "::", ":::", "::::" };
|
||||
for (size_t i = 0; i < ARRAY_SIZE(empty_variations); i++) {
|
||||
const char* cmdline = empty_variations[i];
|
||||
@ -253,7 +253,7 @@ TEST_F(LogConfigurationTest, parse_empty_command_line_arguments) {
|
||||
}
|
||||
|
||||
// Test basic command line parsing & configuration
|
||||
TEST_F(LogConfigurationTest, parse_command_line_arguments) {
|
||||
TEST_VM_F(LogConfigurationTest, parse_command_line_arguments) {
|
||||
// Prepare a command line for logging*=debug on stderr with all decorators
|
||||
int ret;
|
||||
char buf[256];
|
||||
@ -273,7 +273,7 @@ TEST_F(LogConfigurationTest, parse_command_line_arguments) {
|
||||
}
|
||||
|
||||
// Test split up log configuration arguments
|
||||
TEST_F(LogConfigurationTest, parse_log_arguments) {
|
||||
TEST_VM_F(LogConfigurationTest, parse_log_arguments) {
|
||||
ResourceMark rm;
|
||||
stringStream ss;
|
||||
// Verify that it's possible to configure each individual tag
|
||||
@ -296,7 +296,7 @@ TEST_F(LogConfigurationTest, parse_log_arguments) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(LogConfigurationTest, parse_invalid_tagset) {
|
||||
TEST_VM_F(LogConfigurationTest, parse_invalid_tagset) {
|
||||
static const char* invalid_tagset = "logging+start+exit+safepoint+gc"; // Must not exist for test to function.
|
||||
|
||||
// Make sure warning is produced if one or more configured tagsets are invalid
|
||||
@ -309,7 +309,7 @@ TEST_F(LogConfigurationTest, parse_invalid_tagset) {
|
||||
EXPECT_TRUE(string_contains_substring(msg, invalid_tagset));
|
||||
}
|
||||
|
||||
TEST_F(LogConfigurationTest, output_name_normalization) {
|
||||
TEST_VM_F(LogConfigurationTest, output_name_normalization) {
|
||||
const char* patterns[] = { "%s", "file=%s", "\"%s\"", "file=\"%s\"" };
|
||||
char buf[1 * K];
|
||||
for (size_t i = 0; i < ARRAY_SIZE(patterns); i++) {
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
static const LogTagSet& tagset = LogTagSetMapping<LOG_TAGS(logging, safepoint)>::tagset();
|
||||
static const LogDecorators default_decorators;
|
||||
|
||||
TEST(LogDecorations, level) {
|
||||
TEST_VM(LogDecorations, level) {
|
||||
for (uint l = LogLevel::First; l <= LogLevel::Last; l++) {
|
||||
LogLevelType level = static_cast<LogLevelType>(l);
|
||||
// Create a decorations object for the current level
|
||||
@ -52,7 +52,7 @@ TEST(LogDecorations, level) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST(LogDecorations, uptime) {
|
||||
TEST_VM(LogDecorations, uptime) {
|
||||
// Verify the format of the decoration
|
||||
int a, b;
|
||||
char decimal_point;
|
||||
@ -73,7 +73,7 @@ TEST(LogDecorations, uptime) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST(LogDecorations, tags) {
|
||||
TEST_VM(LogDecorations, tags) {
|
||||
char expected_tags[1 * K];
|
||||
tagset.label(expected_tags, sizeof(expected_tags));
|
||||
// Verify that the expected tags are included in the tags decoration
|
||||
@ -82,7 +82,7 @@ TEST(LogDecorations, tags) {
|
||||
}
|
||||
|
||||
// Test each variation of the different timestamp decorations (ms, ns, uptime ms, uptime ns)
|
||||
TEST(LogDecorations, timestamps) {
|
||||
TEST_VM(LogDecorations, timestamps) {
|
||||
struct {
|
||||
const LogDecorators::Decorator decorator;
|
||||
const char* suffix;
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
static const char* name = "file=testlog.pid%p.%t.log";
|
||||
|
||||
// Test parsing a bunch of valid file output options
|
||||
TEST(LogFileOutput, parse_valid) {
|
||||
TEST_VM(LogFileOutput, parse_valid) {
|
||||
const char* valid_options[] = {
|
||||
"", "filecount=10", "filesize=512",
|
||||
"filecount=11,filesize=256",
|
||||
@ -64,7 +64,7 @@ TEST(LogFileOutput, parse_valid) {
|
||||
}
|
||||
|
||||
// Test parsing a bunch of invalid file output options
|
||||
TEST(LogFileOutput, parse_invalid) {
|
||||
TEST_VM(LogFileOutput, parse_invalid) {
|
||||
const char* invalid_options[] = {
|
||||
"invalidopt", "filecount=",
|
||||
"filesize=,filecount=10",
|
||||
@ -91,7 +91,7 @@ TEST(LogFileOutput, parse_invalid) {
|
||||
}
|
||||
|
||||
// Test for overflows with filesize
|
||||
TEST(LogFileOutput, filesize_overflow) {
|
||||
TEST_VM(LogFileOutput, filesize_overflow) {
|
||||
char buf[256];
|
||||
int ret = jio_snprintf(buf, sizeof(buf), "filesize=" SIZE_FORMAT "K", SIZE_MAX);
|
||||
ASSERT_GT(ret, 0) << "Buffer too small";
|
||||
|
||||
@ -43,47 +43,47 @@ static bool check_max_length_overflow(BasicType type) {
|
||||
return (julong) (size_t) bytes == bytes;
|
||||
}
|
||||
|
||||
TEST(arrayOopDesc, boolean) {
|
||||
TEST_VM(arrayOopDesc, boolean) {
|
||||
ASSERT_PRED1(check_max_length_overflow, T_BOOLEAN);
|
||||
}
|
||||
|
||||
TEST(arrayOopDesc, char) {
|
||||
TEST_VM(arrayOopDesc, char) {
|
||||
ASSERT_PRED1(check_max_length_overflow, T_CHAR);
|
||||
}
|
||||
|
||||
TEST(arrayOopDesc, float) {
|
||||
TEST_VM(arrayOopDesc, float) {
|
||||
ASSERT_PRED1(check_max_length_overflow, T_FLOAT);
|
||||
}
|
||||
|
||||
TEST(arrayOopDesc, double) {
|
||||
TEST_VM(arrayOopDesc, double) {
|
||||
ASSERT_PRED1(check_max_length_overflow, T_DOUBLE);
|
||||
}
|
||||
|
||||
TEST(arrayOopDesc, byte) {
|
||||
TEST_VM(arrayOopDesc, byte) {
|
||||
ASSERT_PRED1(check_max_length_overflow, T_BYTE);
|
||||
}
|
||||
|
||||
TEST(arrayOopDesc, short) {
|
||||
TEST_VM(arrayOopDesc, short) {
|
||||
ASSERT_PRED1(check_max_length_overflow, T_SHORT);
|
||||
}
|
||||
|
||||
TEST(arrayOopDesc, int) {
|
||||
TEST_VM(arrayOopDesc, int) {
|
||||
ASSERT_PRED1(check_max_length_overflow, T_INT);
|
||||
}
|
||||
|
||||
TEST(arrayOopDesc, long) {
|
||||
TEST_VM(arrayOopDesc, long) {
|
||||
ASSERT_PRED1(check_max_length_overflow, T_LONG);
|
||||
}
|
||||
|
||||
TEST(arrayOopDesc, object) {
|
||||
TEST_VM(arrayOopDesc, object) {
|
||||
ASSERT_PRED1(check_max_length_overflow, T_OBJECT);
|
||||
}
|
||||
|
||||
TEST(arrayOopDesc, array) {
|
||||
TEST_VM(arrayOopDesc, array) {
|
||||
ASSERT_PRED1(check_max_length_overflow, T_ARRAY);
|
||||
}
|
||||
|
||||
TEST(arrayOopDesc, narrowOop) {
|
||||
TEST_VM(arrayOopDesc, narrowOop) {
|
||||
ASSERT_PRED1(check_max_length_overflow, T_NARROWOOP);
|
||||
}
|
||||
// T_VOID and T_ADDRESS are not supported by max_array_length()
|
||||
|
||||
@ -54,322 +54,322 @@ JSON_GTest::JSON_GTest(const char* text) : JSON(text, false, tty) {
|
||||
parse();
|
||||
}
|
||||
|
||||
TEST(utilities, json_curly_braces) {
|
||||
TEST_VM(utilities, json_curly_braces) {
|
||||
JSON_GTest::test("{}", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_brackets) {
|
||||
TEST_VM(utilities, json_brackets) {
|
||||
JSON_GTest::test("[]", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_space_braces) {
|
||||
TEST_VM(utilities, json_space_braces) {
|
||||
JSON_GTest::test(" { } ", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_space_bracketes) {
|
||||
TEST_VM(utilities, json_space_bracketes) {
|
||||
JSON_GTest::test(" [ ] ", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_quoted_error) {
|
||||
TEST_VM(utilities, json_quoted_error) {
|
||||
JSON_GTest::test("\"error\"", false);
|
||||
}
|
||||
|
||||
TEST(utilities, json_error_string) {
|
||||
TEST_VM(utilities, json_error_string) {
|
||||
JSON_GTest::test("error", false);
|
||||
}
|
||||
|
||||
TEST(utilities, json_simple_integer) {
|
||||
TEST_VM(utilities, json_simple_integer) {
|
||||
JSON_GTest::test("1", false);
|
||||
}
|
||||
|
||||
TEST(utilities, json_siple_float) {
|
||||
TEST_VM(utilities, json_siple_float) {
|
||||
JSON_GTest::test("1.2", false);
|
||||
}
|
||||
|
||||
TEST(utilities, json_simple_boolean_true) {
|
||||
TEST_VM(utilities, json_simple_boolean_true) {
|
||||
JSON_GTest::test("true", false);
|
||||
}
|
||||
|
||||
TEST(utilities, json_simple_boolean_false) {
|
||||
TEST_VM(utilities, json_simple_boolean_false) {
|
||||
JSON_GTest::test("false", false);
|
||||
}
|
||||
|
||||
TEST(utilities, json_simple_null) {
|
||||
TEST_VM(utilities, json_simple_null) {
|
||||
JSON_GTest::test("null", false);
|
||||
}
|
||||
|
||||
TEST(utilities, json_one_element_int_array) {
|
||||
TEST_VM(utilities, json_one_element_int_array) {
|
||||
JSON_GTest::test("[ 1 ]", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_int_array) {
|
||||
TEST_VM(utilities, json_int_array) {
|
||||
JSON_GTest::test("[ 1, ]", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_one_element_bool_array) {
|
||||
TEST_VM(utilities, json_one_element_bool_array) {
|
||||
JSON_GTest::test("[ true ]", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_bool_array) {
|
||||
TEST_VM(utilities, json_bool_array) {
|
||||
JSON_GTest::test("[ true, ]", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_one_element_false_array) {
|
||||
TEST_VM(utilities, json_one_element_false_array) {
|
||||
JSON_GTest::test("[ false ]", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_false_bool_array) {
|
||||
TEST_VM(utilities, json_false_bool_array) {
|
||||
JSON_GTest::test("[ false, ]", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_one_null_array) {
|
||||
TEST_VM(utilities, json_one_null_array) {
|
||||
JSON_GTest::test("[ null ]", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_null_array) {
|
||||
TEST_VM(utilities, json_null_array) {
|
||||
JSON_GTest::test("[ null, ]", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_one_empty_string_array) {
|
||||
TEST_VM(utilities, json_one_empty_string_array) {
|
||||
JSON_GTest::test("[ \"\" ]", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_empty_string_array) {
|
||||
TEST_VM(utilities, json_empty_string_array) {
|
||||
JSON_GTest::test("[ \"\", ]", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_single_string_array) {
|
||||
TEST_VM(utilities, json_single_string_array) {
|
||||
JSON_GTest::test("[ \"elem1\" ]", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_string_comma_arrray) {
|
||||
TEST_VM(utilities, json_string_comma_arrray) {
|
||||
JSON_GTest::test("[ \"elem1\", ]", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_two_strings_array) {
|
||||
TEST_VM(utilities, json_two_strings_array) {
|
||||
JSON_GTest::test("[ \"elem1\", \"elem2\" ]", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_two_strings_comma_array) {
|
||||
TEST_VM(utilities, json_two_strings_comma_array) {
|
||||
JSON_GTest::test("[ \"elem1\", \"elem2\", ]", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_curly_braces_outside) {
|
||||
TEST_VM(utilities, json_curly_braces_outside) {
|
||||
JSON_GTest::test("[ \"elem1\" ] { }", false);
|
||||
}
|
||||
|
||||
TEST(utilities, json_element_in_array) {
|
||||
TEST_VM(utilities, json_element_in_array) {
|
||||
JSON_GTest::test("[ elem1, \"elem2\" ]", false);
|
||||
}
|
||||
|
||||
TEST(utilities, json_incorrect_end_array) {
|
||||
TEST_VM(utilities, json_incorrect_end_array) {
|
||||
JSON_GTest::test("[ \"elem1\"", false);
|
||||
}
|
||||
|
||||
TEST(utilities, json_incorrect_string_end) {
|
||||
TEST_VM(utilities, json_incorrect_string_end) {
|
||||
JSON_GTest::test("[ \"elem1 ]", false);
|
||||
}
|
||||
|
||||
TEST(utilities, json_incorrect_end_of_two_elements_array) {
|
||||
TEST_VM(utilities, json_incorrect_end_of_two_elements_array) {
|
||||
JSON_GTest::test("[ \"elem1\", \"elem2\"", false);
|
||||
}
|
||||
|
||||
TEST(utilities, json_incorrect_bool_true_array) {
|
||||
TEST_VM(utilities, json_incorrect_bool_true_array) {
|
||||
JSON_GTest::test("[ truefoo ]", false);
|
||||
}
|
||||
|
||||
TEST(utilities, json_incorrect_bool_false_array) {
|
||||
TEST_VM(utilities, json_incorrect_bool_false_array) {
|
||||
JSON_GTest::test("[ falsefoo ]", false);
|
||||
}
|
||||
|
||||
TEST(utilities, json_incorrect_null_array) {
|
||||
TEST_VM(utilities, json_incorrect_null_array) {
|
||||
JSON_GTest::test("[ nullfoo ]", false);
|
||||
}
|
||||
|
||||
TEST(utilities, json_key_pair) {
|
||||
TEST_VM(utilities, json_key_pair) {
|
||||
JSON_GTest::test("{ key : 1 }", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_key_pair_comma) {
|
||||
TEST_VM(utilities, json_key_pair_comma) {
|
||||
JSON_GTest::test("{ key : 1, }", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_bool_true_key) {
|
||||
TEST_VM(utilities, json_bool_true_key) {
|
||||
JSON_GTest::test("{ key : true }", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_bool_true_key_comma) {
|
||||
TEST_VM(utilities, json_bool_true_key_comma) {
|
||||
JSON_GTest::test("{ key : true, }", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_bool_false_key) {
|
||||
TEST_VM(utilities, json_bool_false_key) {
|
||||
JSON_GTest::test("{ key : false }", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_bool_false_key_comma) {
|
||||
TEST_VM(utilities, json_bool_false_key_comma) {
|
||||
JSON_GTest::test("{ key : false, }", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_null_key) {
|
||||
TEST_VM(utilities, json_null_key) {
|
||||
JSON_GTest::test("{ key : null }", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_null_key_comma) {
|
||||
TEST_VM(utilities, json_null_key_comma) {
|
||||
JSON_GTest::test("{ key : null, }", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_pair_of_empty_strings) {
|
||||
TEST_VM(utilities, json_pair_of_empty_strings) {
|
||||
JSON_GTest::test("{ \"\" : \"\" }", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_pair_of_empty_strings_comma) {
|
||||
TEST_VM(utilities, json_pair_of_empty_strings_comma) {
|
||||
JSON_GTest::test("{ \"\" : \"\", }", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_pair_of_strings) {
|
||||
TEST_VM(utilities, json_pair_of_strings) {
|
||||
JSON_GTest::test("{ \"key1\" : \"val1\" }", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_pair_of_strings_comma) {
|
||||
TEST_VM(utilities, json_pair_of_strings_comma) {
|
||||
JSON_GTest::test("{ \"key1\" : \"val1\", }", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_two_pairs_of_strings) {
|
||||
TEST_VM(utilities, json_two_pairs_of_strings) {
|
||||
JSON_GTest::test("{ \"key1\" : \"val1\", \"key2\" : \"val2\" }", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_two_pairs_of_strings_comma) {
|
||||
TEST_VM(utilities, json_two_pairs_of_strings_comma) {
|
||||
JSON_GTest::test("{ \"key1\" : \"val1\", \"key2\" : \"val2\", }", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_array_outside) {
|
||||
TEST_VM(utilities, json_array_outside) {
|
||||
JSON_GTest::test("{ \"key\" : \"val\" } [ \"error\" ]", false);
|
||||
}
|
||||
|
||||
TEST(utilities, json_incorrect_object_end) {
|
||||
TEST_VM(utilities, json_incorrect_object_end) {
|
||||
JSON_GTest::test("{ \"key\" : \"val\" ", false);
|
||||
}
|
||||
|
||||
TEST(utilities, json_empty_comment) {
|
||||
TEST_VM(utilities, json_empty_comment) {
|
||||
JSON_GTest::test("/**/ { }", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_space_comment) {
|
||||
TEST_VM(utilities, json_space_comment) {
|
||||
JSON_GTest::test("/* */ { }", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_comment) {
|
||||
TEST_VM(utilities, json_comment) {
|
||||
JSON_GTest::test("/*foo*/ { }", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_star_comment) {
|
||||
TEST_VM(utilities, json_star_comment) {
|
||||
JSON_GTest::test("/* *foo */ { }", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_stars_comment) {
|
||||
TEST_VM(utilities, json_stars_comment) {
|
||||
JSON_GTest::test("/* *foo* */ { }", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_special_comment) {
|
||||
TEST_VM(utilities, json_special_comment) {
|
||||
JSON_GTest::test("/* /*foo */ { }", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_comment_after) {
|
||||
TEST_VM(utilities, json_comment_after) {
|
||||
JSON_GTest::test("{ } /* foo */", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_comment_after_and_space) {
|
||||
TEST_VM(utilities, json_comment_after_and_space) {
|
||||
JSON_GTest::test("{ } /* foo */ ", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_one_line_empty_comment_after) {
|
||||
TEST_VM(utilities, json_one_line_empty_comment_after) {
|
||||
JSON_GTest::test("{ } //", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_one_line_space_comment_after) {
|
||||
TEST_VM(utilities, json_one_line_space_comment_after) {
|
||||
JSON_GTest::test("{ } // ", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_one_line_comment_after) {
|
||||
TEST_VM(utilities, json_one_line_comment_after) {
|
||||
JSON_GTest::test("{ } // foo", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_incorrect_multiline_comment) {
|
||||
TEST_VM(utilities, json_incorrect_multiline_comment) {
|
||||
JSON_GTest::test("/* * / { }", false);
|
||||
}
|
||||
|
||||
TEST(utilities, json_incorrect_multiline_comment_begin) {
|
||||
TEST_VM(utilities, json_incorrect_multiline_comment_begin) {
|
||||
JSON_GTest::test("/ * */ { }", false);
|
||||
}
|
||||
|
||||
TEST(utilities, json_oneline_comment_only) {
|
||||
TEST_VM(utilities, json_oneline_comment_only) {
|
||||
JSON_GTest::test("// { }", false);
|
||||
}
|
||||
|
||||
TEST(utilities, json_multiline_comment_only) {
|
||||
TEST_VM(utilities, json_multiline_comment_only) {
|
||||
JSON_GTest::test("/* { } */", false);
|
||||
}
|
||||
|
||||
TEST(utilities, json_multiline_comment_2) {
|
||||
TEST_VM(utilities, json_multiline_comment_2) {
|
||||
JSON_GTest::test("/* { } */ ", false);
|
||||
}
|
||||
|
||||
TEST(utilities, json_incorrectly_commented_object) {
|
||||
TEST_VM(utilities, json_incorrectly_commented_object) {
|
||||
JSON_GTest::test("/* { } ", false);
|
||||
}
|
||||
|
||||
TEST(utilities, json_missing_multiline_end) {
|
||||
TEST_VM(utilities, json_missing_multiline_end) {
|
||||
JSON_GTest::test("{ } /* ", false);
|
||||
}
|
||||
|
||||
TEST(utilities, json_missing_multiline_slash) {
|
||||
TEST_VM(utilities, json_missing_multiline_slash) {
|
||||
JSON_GTest::test("/* { } *", false);
|
||||
}
|
||||
|
||||
TEST(utilities, json_commented_object_end) {
|
||||
TEST_VM(utilities, json_commented_object_end) {
|
||||
JSON_GTest::test("{ /* } */", false);
|
||||
}
|
||||
|
||||
TEST(utilities, json_commented_array_end) {
|
||||
TEST_VM(utilities, json_commented_array_end) {
|
||||
JSON_GTest::test("[ /* ] */", false);
|
||||
}
|
||||
|
||||
TEST(utilities, json_missing_object_end) {
|
||||
TEST_VM(utilities, json_missing_object_end) {
|
||||
JSON_GTest::test("{ key : \"val\", /* } */", false);
|
||||
}
|
||||
|
||||
TEST(utilities, json_missing_array_end) {
|
||||
TEST_VM(utilities, json_missing_array_end) {
|
||||
JSON_GTest::test("[ \"val\", /* ] */", false);
|
||||
}
|
||||
|
||||
TEST(utilities, json_key_values_1) {
|
||||
TEST_VM(utilities, json_key_values_1) {
|
||||
JSON_GTest::test("/* comment */{ key1 : { \"key2\" : { \"key3\" : [ \"elem1\", \"elem2\","
|
||||
"{ \"key4\" : null }, 3 , 2 , 1 , 0 , -1 , -2 , -3 , true, false, null, ] }, \"key5\""
|
||||
" : true }, \"key6\" : [ \"☃\" ], key7 : \"val\",}", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_key_values_2) {
|
||||
TEST_VM(utilities, json_key_values_2) {
|
||||
JSON_GTest::test("/* comment */ { \"key1\" : { \"key2\" : { \"key3\" : [ \"elem1\", \"elem2\","
|
||||
"{ \"key4\" : null }, 3 , 2 , 1 , 0 , -1 , -2 , -3 , true, false, null, ] }, \"key5\""
|
||||
" : true }, \"key6\" : [ \"☃\" ], key7 : \"val\",}", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_quoted_symbols) {
|
||||
TEST_VM(utilities, json_quoted_symbols) {
|
||||
JSON_GTest::test("/*comment*/{\"ff1 fsd\":{\"☃\":{\"☃\":[\"☃\",\"☃\"]},"
|
||||
"\"☃\":true},\"☃\":[\"☃\"],\"foo\":\"☃\",}", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_incorrect_key) {
|
||||
TEST_VM(utilities, json_incorrect_key) {
|
||||
JSON_GTest::test("/* comment */ { key1 error : { \"☃\" : { \"☃\" : [ \"☃\","
|
||||
" \"☃\" ] }, \"☃\" : true }, \"baz\" : [ \"☃\" ], foo : \"☃\",}",
|
||||
false); // first key needs to be quoted since it contains a space
|
||||
}
|
||||
|
||||
TEST(utilities, json_array_with_newline) {
|
||||
TEST_VM(utilities, json_array_with_newline) {
|
||||
JSON_GTest::test("[\n]", true);
|
||||
}
|
||||
|
||||
TEST(utilities, json_directives_file) {
|
||||
TEST_VM(utilities, json_directives_file) {
|
||||
JSON_GTest::test(
|
||||
"[" "\n"
|
||||
" {"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user