Simplify count_words, add trim_and_count_words
The original count_words function (before it was put into utils::) also trimmed comments. For compatibility this behaviour was retained at first. However, due to the name the trimming is not immediatly apparent and many times not wanted. Therefore, this commit replaces count_words with an implementation that just does what it says. If a comment should be trimmed there is a trim_comment function. For convenience, a trim_and_count_words function was added and is now used where the old behaviour was needed.
This commit is contained in:
@ -25,7 +25,11 @@ TEST(Utils, trim_comment) {
|
||||
}
|
||||
|
||||
TEST(Utils, count_words) {
|
||||
ASSERT_EQ(utils::count_words("some text # comment"), 2);
|
||||
ASSERT_EQ(utils::count_words("some text # comment"), 4);
|
||||
}
|
||||
|
||||
TEST(Utils, trim_and_count_words) {
|
||||
ASSERT_EQ(utils::trim_and_count_words("some text # comment"), 2);
|
||||
}
|
||||
|
||||
TEST(Utils, valid_integer1) {
|
||||
|
||||
Reference in New Issue
Block a user