diff options
| author | Weicao-CatilGrass <1992414357@qq.com> | 2026-05-13 08:39:08 +0800 |
|---|---|---|
| committer | Weicao-CatilGrass <1992414357@qq.com> | 2026-05-13 08:39:08 +0800 |
| commit | 5e59dd5e58a14659cd557dc43d6f5176a13fee9e (patch) | |
| tree | 44e31230fbdc59dc4e1e14961bbb42b2d00d9327 /examples/test-example-async.toml | |
| parent | 8243a48dc00233c9e5911ce278e75d123305cf90 (diff) | |
Add test tool for examples and update exit code demo
Diffstat (limited to 'examples/test-example-async.toml')
| -rw-r--r-- | examples/test-example-async.toml | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/examples/test-example-async.toml b/examples/test-example-async.toml new file mode 100644 index 0000000..a63f566 --- /dev/null +++ b/examples/test-example-async.toml @@ -0,0 +1,54 @@ +[[test.example-async]] +command = "hello World" +expect.exit-code = 0 +expect.result = "Hello, World!" + +[[test.example-basic]] +command = "hello World" +expect.exit-code = 0 +expect.result = "Hello, World!" + +[[test.example-exit-code]] +command = "error" +expect.exit-code = 1 +expect.result = "Exit with exit code: 1" + +[[test.example-general-renderer]] +command = "render Bob 22" +expect.exit-code = 0 +expect.result = "Bob is 22 years old" + +[[test.example-general-renderer]] +command = "render Bob 22 --json" +expect.exit-code = 0 +expect.result = "{\"member_name\":\"Bob\",\"member_age\":22}" + +[[test.example-general-renderer]] +command = "render Bob 22 --yaml" +expect.exit-code = 0 +expect.result = "member_name: Bob\nmember_age: 22" + +[[test.example-picker]] +command = "pick Bob" +expect.exit-code = 0 +expect.result = "Picked: name = Bob, age = 20" + +[[test.example-picker]] +command = "pick Bob --age -15" +expect.exit-code = 0 +expect.result = "Picked: name = Bob, age = 0" + +[[test.example-picker]] +command = "pick --age 99" +expect.exit-code = 0 +expect.result = "No name provided." + +[[test.example-picker]] +command = "pick" +expect.exit-code = 0 +expect.result = "No name provided." + +[[test.example-picker]] +command = "pick --age 150" +expect.exit-code = 0 +expect.result = "No name provided." |
