MCPcopy Create free account
hub / github.com/auula/falsework / test_command_build

Function test_command_build

tests/test.rs:7–26  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5
6 #[test]
7 fn test_command_build() {
8
9 let mut command = cmd::CommandItem {
10 run: |ctx| -> Result<(), Box<dyn Error>> {
11 let x = ctx.value_of("--x").parse::<i32>().unwrap();
12 let y = ctx.value_of("--y").parse::<i32>().unwrap();
13 println!("{} + {} = {}", x, y, x + y);
14 Ok(())
15 },
16 long: "这是一个加法计算程序需要两个flag参数 --x --y",
17 short: "加法计算",
18 r#use: "add",
19 }.build();
20
21 command.bound_flag("--x", "加数");
22
23 command.bound_flag("--y", "被加数");
24
25 println!("{:#?}", command);
26 }
27
28
29 #[test]

Callers

nothing calls this directly

Calls 3

buildMethod · 0.80
value_ofMethod · 0.80
bound_flagMethod · 0.80

Tested by

no test coverage detected