fix(test): Use correct namespace

This commit is contained in:
Michael Carlberg 2017-01-11 05:05:11 +01:00
parent 568837d06a
commit c2bee14d34
1 changed files with 18 additions and 18 deletions

View File

@ -14,60 +14,60 @@ int main() {
}; };
"has_short"_test = [&] { "has_short"_test = [&] {
auto cli = cliparser::make("cmd", get_opts()); auto cli = command_line::parser::make("cmd", get_opts());
cli->process_input(string_util::split("-f", ' ')); cli->process_input(string_util::split("-f", ' '));
expect(cli->has("flag")); expect(cli->has("flag"));
expect(!cli->has("option")); expect(!cli->has("option"));
cli = cliparser::make("cmd", get_opts());; cli = command_line::parser::make("cmd", get_opts());;
cli->process_input(string_util::split("-f -o foo", ' ')); cli->process_input(string_util::split("-f -o foo", ' '));
expect(cli->has("flag")); expect(cli->has("flag"));
expect(cli->has("option")); expect(cli->has("option"));
cli = cliparser::make("cmd", get_opts());; cli = command_line::parser::make("cmd", get_opts());;
cli->process_input(string_util::split("-o baz", ' ')); cli->process_input(string_util::split("-o baz", ' '));
expect(!cli->has("flag")); expect(!cli->has("flag"));
expect(cli->has("option")); expect(cli->has("option"));
}; };
"has_long"_test = [&] { "has_long"_test = [&] {
auto cli = cliparser::make("cmd", get_opts());; auto cli = command_line::parser::make("cmd", get_opts());;
cli->process_input(string_util::split("--flag", ' ')); cli->process_input(string_util::split("--flag", ' '));
expect(cli->has("flag")); expect(cli->has("flag"));
expect(!cli->has("option")); expect(!cli->has("option"));
cli = cliparser::make("cmd", get_opts());; cli = command_line::parser::make("cmd", get_opts());;
cli->process_input(string_util::split("--flag --option=foo", ' ')); cli->process_input(string_util::split("--flag --option=foo", ' '));
expect(cli->has("flag")); expect(cli->has("flag"));
expect(cli->has("option")); expect(cli->has("option"));
cli = cliparser::make("cmd", get_opts());; cli = command_line::parser::make("cmd", get_opts());;
cli->process_input(string_util::split("--option=foo --flag", ' ')); cli->process_input(string_util::split("--option=foo --flag", ' '));
expect(cli->has("flag")); expect(cli->has("flag"));
expect(cli->has("option")); expect(cli->has("option"));
cli = cliparser::make("cmd", get_opts());; cli = command_line::parser::make("cmd", get_opts());;
cli->process_input(string_util::split("--option=baz", ' ')); cli->process_input(string_util::split("--option=baz", ' '));
expect(!cli->has("flag")); expect(!cli->has("flag"));
expect(cli->has("option")); expect(cli->has("option"));
}; };
"compare"_test = [&] { "compare"_test = [&] {
auto cli = cliparser::make("cmd", get_opts());; auto cli = command_line::parser::make("cmd", get_opts());;
cli->process_input(string_util::split("-o baz", ' ')); cli->process_input(string_util::split("-o baz", ' '));
expect(cli->compare("option", "baz")); expect(cli->compare("option", "baz"));
cli = cliparser::make("cmd", get_opts());; cli = command_line::parser::make("cmd", get_opts());;
cli->process_input(string_util::split("--option=foo", ' ')); cli->process_input(string_util::split("--option=foo", ' '));
expect(cli->compare("option", "foo")); expect(cli->compare("option", "foo"));
}; };
"get"_test = [&] { "get"_test = [&] {
auto cli = cliparser::make("cmd", get_opts());; auto cli = command_line::parser::make("cmd", get_opts());;
cli->process_input(string_util::split("--option=baz", ' ')); cli->process_input(string_util::split("--option=baz", ' '));
expect("baz" == cli->get("option")); expect("baz" == cli->get("option"));
cli = cliparser::make("cmd", get_opts());; cli = command_line::parser::make("cmd", get_opts());;
cli->process_input(string_util::split("--option=foo", ' ')); cli->process_input(string_util::split("--option=foo", ' '));
expect("foo" == cli->get("option")); expect("foo" == cli->get("option"));
}; };
@ -79,7 +79,7 @@ int main() {
bool exception_thrown = false; bool exception_thrown = false;
try { try {
auto cli = cliparser::make("cmd", get_opts());; auto cli = command_line::parser::make("cmd", get_opts());;
cli->process_input(input1); cli->process_input(input1);
} catch (const command_line::value_error&) { } catch (const command_line::value_error&) {
exception_thrown = true; exception_thrown = true;
@ -89,7 +89,7 @@ int main() {
exception_thrown = false; // reset exception_thrown = false; // reset
try { try {
auto cli = cliparser::make("cmd", get_opts());; auto cli = command_line::parser::make("cmd", get_opts());;
cli->process_input(input2); cli->process_input(input2);
} catch (const command_line::value_error&) { } catch (const command_line::value_error&) {
exception_thrown = true; exception_thrown = true;
@ -99,7 +99,7 @@ int main() {
exception_thrown = false; // reset exception_thrown = false; // reset
try { try {
auto cli = cliparser::make("cmd", get_opts());; auto cli = command_line::parser::make("cmd", get_opts());;
cli->process_input(input3); cli->process_input(input3);
} catch (const command_line::value_error&) { } catch (const command_line::value_error&) {
exception_thrown = true; exception_thrown = true;
@ -114,7 +114,7 @@ int main() {
bool exception_thrown = false; bool exception_thrown = false;
try { try {
auto cli = cliparser::make("cmd", get_opts());; auto cli = command_line::parser::make("cmd", get_opts());;
cli->process_input(input1); cli->process_input(input1);
} catch (const command_line::value_error&) { } catch (const command_line::value_error&) {
exception_thrown = true; exception_thrown = true;
@ -124,7 +124,7 @@ int main() {
exception_thrown = false; // reset exception_thrown = false; // reset
try { try {
auto cli = cliparser::make("cmd", get_opts());; auto cli = command_line::parser::make("cmd", get_opts());;
cli->process_input(input2); cli->process_input(input2);
} catch (const command_line::value_error&) { } catch (const command_line::value_error&) {
exception_thrown = true; exception_thrown = true;
@ -139,7 +139,7 @@ int main() {
bool exception_thrown = false; bool exception_thrown = false;
try { try {
auto cli = cliparser::make("cmd", get_opts());; auto cli = command_line::parser::make("cmd", get_opts());;
cli->process_input(input1); cli->process_input(input1);
} catch (const command_line::argument_error&) { } catch (const command_line::argument_error&) {
exception_thrown = true; exception_thrown = true;
@ -149,7 +149,7 @@ int main() {
exception_thrown = false; // reset exception_thrown = false; // reset
try { try {
auto cli = cliparser::make("cmd", get_opts());; auto cli = command_line::parser::make("cmd", get_opts());;
cli->process_input(input2); cli->process_input(input2);
} catch (const command_line::argument_error&) { } catch (const command_line::argument_error&) {
exception_thrown = true; exception_thrown = true;