Skip to content

Commit 2420094

Browse files
committed
Add test for custom name
1 parent b0dab08 commit 2420094

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

test/group_auto.cpp

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,32 @@ struct delete_ : cli::command<delete_>
2424
}
2525
};
2626

27+
struct custom_name : cli::command<custom_name>
28+
{
29+
static const char* name() { return "run"; }
30+
custom_name() {}
31+
void run(cli& c)
32+
{
33+
c.name = "run";
34+
}
35+
};
36+
2737
PROVE_CASE()
2838
{
29-
cli cmd1;
30-
args::parse(cmd1, {"init"});
31-
PROVE_CHECK(cmd1.name == "init");
39+
cli cmd;
40+
args::parse(cmd, {"init"});
41+
PROVE_CHECK(cmd.name == "init");
42+
}
3243

33-
cli cmd2;
34-
args::parse(cmd2, {"delete"});
44+
PROVE_CASE()
45+
{
46+
cli cmd;
47+
args::parse(cmd, {"run"});
48+
PROVE_CHECK(cmd.name == "run");
49+
}
50+
51+
PROVE_CASE()
52+
{
53+
cli cmd;
54+
args::parse(cmd, {"delete"});
3555
}

0 commit comments

Comments
 (0)