summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/comptime.zig18
-rw-r--r--src/streaming.zig12
2 files changed, 15 insertions, 15 deletions
diff --git a/src/comptime.zig b/src/comptime.zig
index 0a4257e..b9021de 100644
--- a/src/comptime.zig
+++ b/src/comptime.zig
@@ -1,7 +1,7 @@
1const clap = @import("index.zig"); 1const clap = @import("index.zig");
2const std = @import("std"); 2const std = @import("std");
3 3
4const debug = std.debug; 4const testing = std.testing;
5const heap = std.heap; 5const heap = std.heap;
6const mem = std.mem; 6const 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, &iter); 130 var args = try Clap.parse(&fb_allocator.allocator, clap.args.SliceIterator, &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 babc573..7bdc71f 100644
--- a/src/streaming.zig
+++ b/src/streaming.zig
@@ -3,7 +3,7 @@ const clap = @import("index.zig");
3const std = @import("std"); 3const std = @import("std");
4 4
5const args = clap.args; 5const args = clap.args;
6const debug = std.debug; 6const testing = std.testing;
7const heap = std.heap; 7const heap = std.heap;
8const mem = std.mem; 8const mem = std.mem;
9const os = std.os; 9const 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