-
Notifications
You must be signed in to change notification settings - Fork 276
Refactoring around the goto-cc entry point. #5442
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
Merged
thomasspriggs
merged 8 commits into
diffblue:develop
from
thomasspriggs:tas/goto-cc-refactoring
Aug 11, 2020
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
00bdff1
Make `goto_cc_modet::help` non-virtual
thomasspriggs 1fc57a6
Move `goto_cc_cmdlinet::have_infile_arg` to `.cpp`
thomasspriggs f0b4f89
Refactor `goto_cc_cmdlinet::have_infile_arg` using `std::any_of`
thomasspriggs 1eaa260
Make `goto_cc_modet::main` non-virtual
thomasspriggs 0313558
Move `prefix_in_list` to the single location where it is used
thomasspriggs cc12dff
Refactor `prefix_in_list` to return its result using `optionalt`
thomasspriggs eb7b032
Refactor `prefix_in_list` to take vector of strings
thomasspriggs f7787c8
Add unit test of `prefix_in_list`
thomasspriggs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/// \file | ||
/// Unit tests of src/goto-cc/armcc_cmdline.cpp | ||
/// \author Diffblue Ltd. | ||
|
||
#include <testing-utils/use_catch.h> | ||
|
||
#include <util/optional.h> | ||
|
||
#include <string> | ||
#include <vector> | ||
|
||
optionalt<std::string> | ||
prefix_in_list(const std::string &option, const std::vector<std::string> &list); | ||
|
||
static const std::vector<std::string> test_list{"spam", "eggs", "and", "ham"}; | ||
|
||
TEST_CASE("prefix_in_list exact match", "[core][armcc_cmdline][prefix_in_list]") | ||
{ | ||
REQUIRE(*prefix_in_list("spam", test_list) == "spam"); | ||
REQUIRE(*prefix_in_list("ham", test_list) == "ham"); | ||
} | ||
|
||
TEST_CASE( | ||
"prefix_in_list match prefix", | ||
"[core][armcc_cmdline][prefix_in_list]") | ||
{ | ||
REQUIRE(*prefix_in_list("sp", test_list) == "spam"); | ||
REQUIRE(*prefix_in_list("ha", test_list) == "ham"); | ||
} | ||
|
||
TEST_CASE("prefix_in_list unmatched", "[core][armcc_cmdline][prefix_in_list]") | ||
{ | ||
REQUIRE_FALSE(prefix_in_list("foobar", test_list)); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
goto-cc | ||
testing-utils | ||
util |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should probably just make sure to put definitions in cpp files in general.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍