diff options
Diffstat (limited to '')
| -rw-r--r-- | src/comptime.zig | 18 | ||||
| -rw-r--r-- | src/streaming.zig | 12 |
2 files changed, 15 insertions, 15 deletions
diff --git a/src/comptime.zig b/src/comptime.zig index 808915d..5339da3 100644 --- a/src/comptime.zig +++ b/src/comptime.zig | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | const clap = @import("index.zig"); | 1 | const clap = @import("index.zig"); |
| 2 | const std = @import("std"); | 2 | const std = @import("std"); |
| 3 | 3 | ||
| 4 | const debug = std.debug; | 4 | const testing = std.testing; |
| 5 | const heap = std.heap; | 5 | const heap = std.heap; |
| 6 | const mem = std.mem; | 6 | const mem = std.mem; |
| 7 | 7 | ||
| @@ -130,12 +130,12 @@ test "clap.comptime.ComptimeClap" { | |||
| 130 | var args = try Clap.parse(&fb_allocator.allocator, clap.args.SliceIterator.Error, &arg_iter.iter); | 130 | var args = try Clap.parse(&fb_allocator.allocator, clap.args.SliceIterator.Error, &arg_iter.iter); |
| 131 | defer args.deinit(); | 131 | defer args.deinit(); |
| 132 | 132 | ||
| 133 | debug.assert(args.flag("-a")); | 133 | testing.expect(args.flag("-a")); |
| 134 | debug.assert(args.flag("--aa")); | 134 | testing.expect(args.flag("--aa")); |
| 135 | debug.assert(!args.flag("-b")); | 135 | testing.expect(!args.flag("-b")); |
| 136 | debug.assert(!args.flag("--bb")); | 136 | testing.expect(!args.flag("--bb")); |
| 137 | debug.assert(mem.eql(u8, args.option("-c").?, "0")); | 137 | testing.expectEqualSlices(u8, "0", args.option("-c").?); |
| 138 | debug.assert(mem.eql(u8, args.option("--cc").?, "0")); | 138 | testing.expectEqualSlices(u8, "0", args.option("--cc").?); |
| 139 | debug.assert(args.positionals().len == 1); | 139 | testing.expectEqual(usize(1), args.positionals().len); |
| 140 | debug.assert(mem.eql(u8, args.positionals()[0], "something")); | 140 | testing.expectEqualSlices(u8, "something", args.positionals()[0]); |
| 141 | } | 141 | } |
diff --git a/src/streaming.zig b/src/streaming.zig index f33fd96..cc5da79 100644 --- a/src/streaming.zig +++ b/src/streaming.zig | |||
| @@ -3,7 +3,7 @@ const clap = @import("index.zig"); | |||
| 3 | const std = @import("std"); | 3 | const std = @import("std"); |
| 4 | 4 | ||
| 5 | const args = clap.args; | 5 | const args = clap.args; |
| 6 | const debug = std.debug; | 6 | const testing = std.testing; |
| 7 | const heap = std.heap; | 7 | const heap = std.heap; |
| 8 | const mem = std.mem; | 8 | const mem = std.mem; |
| 9 | const os = std.os; | 9 | const os = std.os; |
| @@ -194,17 +194,17 @@ fn testNoErr(params: []const clap.Param(u8), args_strings: []const []const u8, r | |||
| 194 | 194 | ||
| 195 | for (results) |res| { | 195 | for (results) |res| { |
| 196 | const arg = (c.next() catch unreachable) orelse unreachable; | 196 | const arg = (c.next() catch unreachable) orelse unreachable; |
| 197 | debug.assert(res.param == arg.param); | 197 | testing.expectEqual(res.param, arg.param); |
| 198 | const expected_value = res.value orelse { | 198 | const expected_value = res.value orelse { |
| 199 | debug.assert(arg.value == null); | 199 | testing.expectEqual(@typeOf(arg.value)(null), arg.value); |
| 200 | continue; | 200 | continue; |
| 201 | }; | 201 | }; |
| 202 | const actual_value = arg.value orelse unreachable; | 202 | const actual_value = arg.value orelse unreachable; |
| 203 | debug.assert(mem.eql(u8, expected_value, actual_value)); | 203 | testing.expectEqualSlices(u8, expected_value, actual_value); |
| 204 | } | 204 | } |
| 205 | 205 | ||
| 206 | if (c.next() catch unreachable) |_| { | 206 | if (c.next() catch @panic("")) |_| { |
| 207 | unreachable; | 207 | @panic(""); |
| 208 | } | 208 | } |
| 209 | } | 209 | } |
| 210 | 210 | ||