MCPcopy Create free account
hub / github.com/apache/trafficserver / TEST

Function TEST

lib/yamlcpp/test/integration/error_messages_test.cpp:16–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14namespace {
15
16TEST(ErrorMessageTest, BadSubscriptErrorMessage) {
17 const char *example_yaml = "first:\n"
18 " second: 1\n"
19 " third: 2\n";
20
21 Node doc = Load(example_yaml);
22
23 // Test that printable key is part of error message
24 EXPECT_THROW_EXCEPTION(YAML::BadSubscript, doc["first"]["second"]["fourth"],
25 "operator[] call on a scalar (key: \"fourth\")");
26
27 EXPECT_THROW_EXCEPTION(YAML::BadSubscript, doc["first"]["second"][37],
28 "operator[] call on a scalar (key: \"37\")");
29
30
31 // Non-printable key is not included in error message
32 EXPECT_THROW_EXCEPTION(YAML::BadSubscript,
33 doc["first"]["second"][std::vector<int>()],
34 "operator[] call on a scalar");
35
36 EXPECT_THROW_EXCEPTION(YAML::BadSubscript, doc["first"]["second"][Node()],
37 "operator[] call on a scalar");
38}
39
40TEST(ErrorMessageTest, Ex9_1_InvalidNodeErrorMessage) {
41 const char *example_yaml = "first:\n"

Callers

nothing calls this directly

Calls 2

LoadFunction · 0.85
NodeClass · 0.50

Tested by

no test coverage detected