diff options
| author | 2020-11-10 18:31:35 +0100 | |
|---|---|---|
| committer | 2020-11-10 18:31:35 +0100 | |
| commit | cc0885a2fd8c4bbfbf8ffbe6e31a8d0540fec495 (patch) | |
| tree | d025ff320915d560a720716a77a652ff63026ff4 /clap | |
| parent | Improve Diagnostic error message reporting (diff) | |
| download | zig-clap-cc0885a2fd8c4bbfbf8ffbe6e31a8d0540fec495.tar.gz zig-clap-cc0885a2fd8c4bbfbf8ffbe6e31a8d0540fec495.tar.xz zig-clap-cc0885a2fd8c4bbfbf8ffbe6e31a8d0540fec495.zip | |
Better parseParam
Diffstat (limited to 'clap')
| -rw-r--r-- | clap/comptime.zig | 4 | ||||
| -rw-r--r-- | clap/streaming.zig | 10 |
2 files changed, 2 insertions, 12 deletions
diff --git a/clap/comptime.zig b/clap/comptime.zig index 1570eaf..80eb428 100644 --- a/clap/comptime.zig +++ b/clap/comptime.zig | |||
| @@ -152,9 +152,7 @@ test "" { | |||
| 152 | clap.parseParam("-b, --bb ") catch unreachable, | 152 | clap.parseParam("-b, --bb ") catch unreachable, |
| 153 | clap.parseParam("-c, --cc <V>") catch unreachable, | 153 | clap.parseParam("-c, --cc <V>") catch unreachable, |
| 154 | clap.parseParam("-d, --dd <V>...") catch unreachable, | 154 | clap.parseParam("-d, --dd <V>...") catch unreachable, |
| 155 | clap.Param(clap.Help){ | 155 | clap.parseParam("<P>") catch unreachable, |
| 156 | .takes_value = .One, | ||
| 157 | }, | ||
| 158 | }); | 156 | }); |
| 159 | 157 | ||
| 160 | var buf: [1024]u8 = undefined; | 158 | var buf: [1024]u8 = undefined; |
diff --git a/clap/streaming.zig b/clap/streaming.zig index 602d94a..844cbf7 100644 --- a/clap/streaming.zig +++ b/clap/streaming.zig | |||
| @@ -208,15 +208,7 @@ fn testErr(params: []const clap.Param(u8), args_strings: []const []const u8, exp | |||
| 208 | var buf: [1024]u8 = undefined; | 208 | var buf: [1024]u8 = undefined; |
| 209 | var slice_stream = io.fixedBufferStream(&buf); | 209 | var slice_stream = io.fixedBufferStream(&buf); |
| 210 | diag.report(slice_stream.outStream(), err) catch unreachable; | 210 | diag.report(slice_stream.outStream(), err) catch unreachable; |
| 211 | 211 | testing.expectEqualStrings(expected, slice_stream.getWritten()); | |
| 212 | const actual = slice_stream.getWritten(); | ||
| 213 | if (!mem.eql(u8, actual, expected)) { | ||
| 214 | debug.warn("\n============ Expected ============\n", .{}); | ||
| 215 | debug.warn("{}", .{expected}); | ||
| 216 | debug.warn("============= Actual =============\n", .{}); | ||
| 217 | debug.warn("{}", .{actual}); | ||
| 218 | testing.expect(false); | ||
| 219 | } | ||
| 220 | return; | 212 | return; |
| 221 | }) |_| {} | 213 | }) |_| {} |
| 222 | 214 | ||