MCPcopy Create free account
hub / github.com/NPP-JSONViewer/JSON-Viewer / TEST_F

Function TEST_F

tests/UnitTest/JsonFormatTest.cpp:26–41  ·  view source on GitHub ↗

Test 1: Test valid JSON with default formatting options

Source from the content-addressed store, hash-verified

24
25 // Test 1: Test valid JSON with default formatting options
26 TEST_F(JsonFormatTest, FormatJson_ValidJson_DefaultOptions)
27 {
28 std::string inputJson = R"({"name": "John", "age": 30})";
29 LE lineEndingOption = rj::kLf;
30 LF formatOptions = rj::kFormatDefault;
31 char indentChar = ' ';
32 unsigned indentLen = 4;
33
34 auto result = m_jsonFormatter.FormatJson(inputJson, lineEndingOption, formatOptions, indentChar, indentLen);
35
36 EXPECT_TRUE(result.success);
37 EXPECT_EQ(result.error_code, -1);
38 EXPECT_EQ(result.error_pos, -1);
39 EXPECT_EQ(result.error_str, "");
40 EXPECT_EQ(result.response, "{\n \"name\": \"John\",\n \"age\": 30\n}");
41 }
42
43 // Test 2: Test invalid JSON input
44 TEST_F(JsonFormatTest, FormatJson_InvalidJson)

Callers

nothing calls this directly

Calls 1

FormatJsonMethod · 0.45

Tested by

no test coverage detected