Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove duplicate and buggy implementation of getWord(). #154

Closed

Conversation

antiagainst
Copy link
Contributor

We already have a better getWord() implemented as a free function.
Use that instead of creating another one.

Addresses #152.

@@ -62,6 +62,27 @@ TEST(GetWord, Simple) {
EXPECT_EQ("abc", AssemblyContext(AutoText("abc\n"), nullptr).getWord());
}

TEST(GetWord, MultipleWords) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tests more than just multiple words -- it tests various forms of word break. I'd split it into multiple tests with separate responsibilities.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reasonable. Removed different whitespaces since they are tested in the previous test.

We already have a better getWord() implemented as a free function.
Use that instead of creating another one.
case '\r':
case '\n':
case ' ':
return std::string(text_->str, text_->str + index);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the direct reason why #126 behaves like that. We should return string(text_->str + current_position_.index, ...).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I figure it's better to use the more robust version of getWord() anyway.

@antiagainst
Copy link
Contributor Author

A better way to fix this in done via #155.

@antiagainst antiagainst deleted the invalid-opcodename branch March 15, 2016 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants