mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Selector splitting: don't split selectors in the middle of whitelisted "multi-words".
Swift SVN r16016
This commit is contained in:
@@ -73,3 +73,26 @@ TEST(ToSentencecaseTest, Words) {
|
||||
EXPECT_EQ(camel_case::toSentencecase("URL", scratch), "URL");
|
||||
EXPECT_EQ(camel_case::toSentencecase("", scratch), "");
|
||||
}
|
||||
|
||||
TEST(MultiWordsTest, Match) {
|
||||
camel_case::MultiWordMap multiWords;
|
||||
multiWords.insert("attributed", "string");
|
||||
multiWords.insert("table", "view");
|
||||
multiWords.insert("table", "view", "controller");
|
||||
multiWords.insert("table", "top");
|
||||
|
||||
auto words1 = camel_case::getWords("createTableView");
|
||||
EXPECT_EQ(*multiWords.match(words1.rbegin(), words1.rend()), "Table");
|
||||
|
||||
auto words2 = camel_case::getWords("createTableViewController");
|
||||
EXPECT_EQ(*multiWords.match(words2.rbegin(), words2.rend()), "Table");
|
||||
|
||||
auto words3 = camel_case::getWords("createSubview");
|
||||
EXPECT_EQ(*multiWords.match(words3.rbegin(), words3.rend()), "Subview");
|
||||
|
||||
auto words4 = camel_case::getWords("addView");
|
||||
EXPECT_EQ(*multiWords.match(words4.rbegin(), words4.rend()), "View");
|
||||
|
||||
auto words5 = camel_case::getWords("insertAttributedString");
|
||||
EXPECT_EQ(*multiWords.match(words5.rbegin(), words5.rend()), "Attributed");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user