diff --git a/generate.ts b/generate.ts index 9b5a949f7ce31c46c77726d9ba3eabaf894ecfcd..7447f877bcbda19614f284aeb16225c36519b5bd 100644 --- a/generate.ts +++ b/generate.ts @@ -54,7 +54,7 @@ pub fn parsePass(input: []const u8, base: ?[]const u8, href: []const u8, origin: try expect(u.password).toEqualString(password); _ = host; _ = hostname; - _ = port; + try expect(u.port).toEqualString(port); _ = pathname; _ = search; _ = hash; diff --git a/url.zig b/url.zig index acf38dc4c3840356531bbc57faa2e610adef9940..f483a6e9b2e9cc56d40b3c70873ca4f98f6f63cb 100644 --- a/url.zig +++ b/url.zig @@ -10,6 +10,7 @@ pub const URL = struct { protocol: []const u8, username: []const u8, password: []const u8, + port: []const u8, pub const HostKind = enum { name, @@ -783,6 +784,7 @@ pub const URL = struct { .protocol = _href[0..extras.sum(usize, href.lengths[0..2])], .username = _href[extras.sum(usize, href.lengths[0..2])..][0..href.lengths[3]], .password = _href[extras.sum(usize, href.lengths[0..4])..][0..href.lengths[5]], + .port = _href[extras.sum(usize, href.lengths[0..8])..][0..href.lengths[9]], }; return url; } diff --git a/zig-out/test.zig b/zig-out/test.zig index 1d41aa44f7beb4d952b0acf214de70366495bc8b..5494cb956ef8efd3b9f25e27e930dc5bd38e5690 100644 --- a/zig-out/test.zig +++ b/zig-out/test.zig @@ -24,7 +24,7 @@ pub fn parsePass(input: []const u8, base: ?[]const u8, href: []const u8, origin: try expect(u.password).toEqualString(password); _ = host; _ = hostname; - _ = port; + try expect(u.port).toEqualString(port); _ = pathname; _ = search; _ = hash;