Commits

David Mugnai committed 1a8052e

test (not passed) for tag attributes

  • Participants
  • Parent commits 760e07f

Comments (0)

Files changed (1)

File tests/test_slam_parser.cpp

 
 TEST(BasicParser, just_one_tag) {
     auto result = static_cast<Tag*>(parse("html"));
+    ASSERT_NE(result, nullptr);
+
     EXPECT_EQ(result->name, "html");
     EXPECT_EQ(result->children.size(), 0);
     EXPECT_EQ(result->attribs.size(), 0);
 
 TEST(BasicParser, one_child) {
     auto result = static_cast<Tag*>(parse("html\n  head"));
+    ASSERT_NE(result, nullptr);
+
     EXPECT_EQ(result->name, "html");
     EXPECT_EQ(result->children.size(), 1);
 
     auto child = static_cast<Tag*>(result->children[0]);
     EXPECT_EQ(child->name, "head");
 }
+
+TEST(BasicParser, one_tag_one_attrib) {
+    auto result = static_cast<Tag*>(parse("html id=\"42\""));
+    ASSERT_NE(result, nullptr);
+
+    EXPECT_EQ(result->name, "html");
+    EXPECT_EQ(result->children.size(), 0);
+    EXPECT_EQ(result->attribs.size(), 1);
+    EXPECT_EQ(result->attribs["id"], "42");
+}