comparison unittests/Support/SpecialCaseListTest.cpp @ 134:3a76565eade5 LLVM5.0.1

update 5.0.1
author mir3636
date Sat, 17 Feb 2018 09:57:20 +0900
parents 803732b1fca8
children c2174574ed3a
comparison
equal deleted inserted replaced
133:c60214abe0e8 134:3a76565eade5
56 EXPECT_TRUE(SCL->inSection("", "src", "hi", "category")); 56 EXPECT_TRUE(SCL->inSection("", "src", "hi", "category"));
57 EXPECT_TRUE(SCL->inSection("", "src", "zzzz", "category")); 57 EXPECT_TRUE(SCL->inSection("", "src", "zzzz", "category"));
58 EXPECT_FALSE(SCL->inSection("", "src", "hi")); 58 EXPECT_FALSE(SCL->inSection("", "src", "hi"));
59 EXPECT_FALSE(SCL->inSection("", "fun", "hello")); 59 EXPECT_FALSE(SCL->inSection("", "fun", "hello"));
60 EXPECT_FALSE(SCL->inSection("", "src", "hello", "category")); 60 EXPECT_FALSE(SCL->inSection("", "src", "hello", "category"));
61
62 EXPECT_EQ(3u, SCL->inSectionBlame("", "src", "hello"));
63 EXPECT_EQ(4u, SCL->inSectionBlame("", "src", "bye"));
64 EXPECT_EQ(5u, SCL->inSectionBlame("", "src", "hi", "category"));
65 EXPECT_EQ(6u, SCL->inSectionBlame("", "src", "zzzz", "category"));
66 EXPECT_EQ(0u, SCL->inSectionBlame("", "src", "hi"));
67 EXPECT_EQ(0u, SCL->inSectionBlame("", "fun", "hello"));
68 EXPECT_EQ(0u, SCL->inSectionBlame("", "src", "hello", "category"));
69 }
70
71 TEST_F(SpecialCaseListTest, CorrectErrorLineNumberWithBlankLine) {
72 std::string Error;
73 EXPECT_EQ(nullptr, makeSpecialCaseList("# This is a comment.\n"
74 "\n"
75 "[not valid\n",
76 Error));
77 EXPECT_TRUE(
78 ((StringRef)Error).startswith("malformed section header on line 3:"));
79
80 EXPECT_EQ(nullptr, makeSpecialCaseList("\n\n\n"
81 "[not valid\n",
82 Error));
83 EXPECT_TRUE(
84 ((StringRef)Error).startswith("malformed section header on line 4:"));
61 } 85 }
62 86
63 TEST_F(SpecialCaseListTest, SectionRegexErrorHandling) { 87 TEST_F(SpecialCaseListTest, SectionRegexErrorHandling) {
64 std::string Error; 88 std::string Error;
65 EXPECT_EQ(makeSpecialCaseList("[address", Error), nullptr); 89 EXPECT_EQ(makeSpecialCaseList("[address", Error), nullptr);