From 0f7b2a50b05f38d886234ff6b031766c7af1dabb Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Thu, 18 Jun 2026 22:48:16 +0800 Subject: Add `pack_err!` macro for error structs with automatic name field --- examples/test-examples.toml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'examples/test-examples.toml') diff --git a/examples/test-examples.toml b/examples/test-examples.toml index 8d2cf0d..4a50ab1 100644 --- a/examples/test-examples.toml +++ b/examples/test-examples.toml @@ -207,3 +207,23 @@ expect.result = "Hello, Alice!" command = "greet Alice -r 5" expect.exit-code = 0 expect.result = "Hello, Alice, Alice, Alice, Alice, Alice!" + +[[test.example-pack-err]] +command = "find" +expect.exit-code = 0 +expect.result = "Search path not provided" + +[[test.example-pack-err]] +command = "find --json" +expect.exit-code = 0 +expect.result = '{"name":"error_not_found"}' + +[[test.example-pack-err]] +command = "find Cargo.toml" +expect.exit-code = 0 +expect.result = "Not a directory: Cargo.toml" + +[[test.example-pack-err]] +command = "find Cargo.toml --json" +expect.exit-code = 0 +expect.result = '{"name":"error_not_dir","info":"Cargo.toml"}' -- cgit