Skip to content

Commit 51a2d30

Browse files
committed
add support for 0.11 package management
1 parent 8eb2b84 commit 51a2d30

File tree

2 files changed

+27
-20
lines changed

2 files changed

+27
-20
lines changed

build.zig

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
}

getopt.zig

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)