File tree Expand file tree Collapse file tree 2 files changed +27
-20
lines changed
Expand file tree Collapse file tree 2 files changed +27
-20
lines changed Original file line number Diff line number Diff line change 1+ const std = @import ("std" );
2+
3+ pub fn build (b : * std.build.Builder ) void {
4+ const target = b .standardTargetOptions (.{});
5+ const optimize = b .standardOptimizeOption (.{});
6+
7+ _ = b .addModule ("getopt" , .{
8+ .source_file = .{
9+ .path = "getopt.zig" ,
10+ },
11+ });
12+
13+ const tests = b .addTest (.{
14+ .root_source_file = .{ .path = "getopt.zig" },
15+ .target = target ,
16+ .optimize = optimize ,
17+ });
18+ const run_tests = b .addRunArtifact (tests );
19+
20+ const test_step = b .step ("test" , "Run tests" );
21+ test_step .dependOn (& run_tests .step );
22+ }
Original file line number Diff line number Diff line change @@ -159,15 +159,9 @@ test "with args separate" {
159159 };
160160
161161 const expected = [_ ]Option {
162- .{
163- .opt = 'a' ,
164- .arg = "10" ,
165- },
162+ .{ .opt = 'a' , .arg = "10" },
166163 .{ .opt = 'b' },
167- .{
168- .opt = 'c' ,
169- .arg = "42" ,
170- },
164+ .{ .opt = 'c' , .arg = "42" },
171165 };
172166
173167 var opts = getoptArgv (& argv , "a:bc:" );
@@ -192,15 +186,9 @@ test "with args joined" {
192186 };
193187
194188 const expected = [_ ]Option {
195- .{
196- .opt = 'a' ,
197- .arg = "10" ,
198- },
189+ .{ .opt = 'a' , .arg = "10" },
199190 .{ .opt = 'b' },
200- .{
201- .opt = 'c' ,
202- .arg = "42" ,
203- },
191+ .{ .opt = 'c' , .arg = "42" },
204192 };
205193
206194 var opts = getoptArgv (& argv , "a:bc:" );
@@ -268,10 +256,7 @@ test "positional args" {
268256 const expected = [_ ]Option {
269257 .{ .opt = 'a' },
270258 .{ .opt = 'b' },
271- .{
272- .opt = 'c' ,
273- .arg = "10" ,
274- },
259+ .{ .opt = 'c' , .arg = "10" },
275260 .{ .opt = 'd' },
276261 };
277262
You can’t perform that action at this time.
0 commit comments