-
-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathsingle_parser_run_test.cpp
More file actions
39 lines (31 loc) · 881 Bytes
/
single_parser_run_test.cpp
File metadata and controls
39 lines (31 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
Copyright René Ferdinand Rivera Morell
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#include <lyra/lyra.hpp>
#include "mini_test.hpp"
int main()
{
using namespace lyra;
bfg::mini_test::scope test;
std::string name;
auto p = cli() | opt(name, "name")["-n"]["--name"]("the name to use");
name = "";
p.parse( { "TestApp", "-n", "Vader" } );
test(REQUIRE(name == "Vader"));
name = "";
p.parse( { "TestApp", "--name", "Vader" } );
test(REQUIRE(name == "Vader"));
name = "";
p.parse( { "TestApp", "-n=Vader" } );
test(REQUIRE(name == "Vader"));
name = "";
p.parse( { "TestApp" } );
test(REQUIRE(name == ""));
name = "";
p.parse( { "TestApp", "-f" } );
test(REQUIRE(name == ""));
return test;
}