Skip to content

Commit

Permalink
Test parser could not handle --s embedded in comments (#242)
Browse files Browse the repository at this point in the history
If there was a -- embedded in a comment (e.g., after a #), the test
parser still attempted to treat that as if it were a test parser
directive.

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
  • Loading branch information
hawkinsw committed May 7, 2024
1 parent fd71083 commit de61836
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/bpf_test_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ parse_test_file(const std::filesystem::path& data_file)
if (!line.empty() && line.back() == '\r') {
line.pop_back();
}
if (line.find("#") != std::string::npos) {
line = line.substr(0, line.find("#"));
}
if (line.find("--") != std::string::npos) {
if (line.find("asm") != std::string::npos) {
state = _state::state_assembly;
Expand Down Expand Up @@ -72,9 +75,6 @@ parse_test_file(const std::filesystem::path& data_file)

switch (state) {
case _state::state_assembly:
if (line.find("#") != std::string::npos) {
line = line.substr(0, line.find("#"));
}
data_out << line << std::endl;
break;
case _state::state_result:
Expand Down

0 comments on commit de61836

Please sign in to comment.