Skip to content
Snippets Groups Projects
Commit 1363978d authored by Oliver Heidmann's avatar Oliver Heidmann
Browse files

added simple tests for spliting arguments

parent 03a8e1bf
No related branches found
No related tags found
1 merge request!232M300433/enable comma in oper args
Pipeline #70221 passed
......@@ -101,10 +101,20 @@ go_bandit([]() {
});
});
bandit::describe("Testing function 'tokenize_comma_seperated_int_list'",
[]() {
});
bandit::describe("Testing function 'split_args'", []() {
bandit::it("splits simple arguments", []() {
std::string test_args = "abc,def,ghi";
std::vector<std::string> expected = { "abc", "def", "ghi" };
std::vector<std::string> result = split_args(test_args);
AssertThat(result, EqualsContainer(expected));
});
bandit::it("allows for ',' to be escaped and removes the '\\'", []() {
std::string test_args = "abc,\"def\\,ghi\",jkl";
std::vector<std::string> expected = { "abc", "\"def,ghi\"", "jkl" };
std::vector<std::string> result = split_args(test_args);
AssertThat(result, EqualsContainer(expected));
});
});
});
int
main(int argc, char **argv)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment