30 const std::string input_file =
fixture_path(
"test_input.json");
31 const std::string json_string =
read_file(input_file);
35 bool preserve_newlines;
36 const char* expected_file;
39 const std::array<TestCase, 4> test_cases{{
40 {
false,
false,
"test_output_no_whitespace_no_newlines.json"},
41 {
false,
true,
"test_output_no_whitespace_preserve_newlines.json"},
42 {
true,
false,
"test_output_whitespace_no_newlines.json"},
43 {
true,
true,
"test_output_whitespace_preserve_newlines.json"}
46 for (
const TestCase& test_case : test_cases) {
49 test_case.with_whitespace,
50 test_case.preserve_newlines);
52 const std::string expected_path =
fixture_path(test_case.expected_file);
53 const std::string expected =
read_file(expected_path);
55 if (actual != expected) {
57 <<
"Mismatch for case "
58 <<
"with_whitespace=" << test_case.with_whitespace <<
", "
59 <<
"preserve_newlines=" << test_case.preserve_newlines <<
", "
60 <<
"expected_file=" << expected_path
66 std::cout <<
"All JSON comment stripping checks passed." << std::endl;
68 }
catch (
const std::exception& e) {
69 std::cerr <<
"Error: " << e.what() << std::endl;