| 1 | const std = @import("std"); |
| 2 | const url = @import("url"); |
| 3 | const expect = @import("expect").expect; |
| 4 | |
| 5 | test { |
| 6 | _ = @import("./zig-out/test.zig"); |
| 7 | } |
| 8 | |
| 9 | test { |
| 10 | _ = @import("./test.SearchParams.zig"); |
| 11 | } |
| 12 | |
| 13 | test { |
| 14 | const allocator = std.testing.allocator; |
| 15 | const u = try url.URL.parse(allocator, "https://en.wikipedia.org/w/index.php?title=URL", null); |
| 16 | defer allocator.free(u.href); |
| 17 | try expect(u.host).toEqualString("en.wikipedia.org"); |
| 18 | var search = try u.searchParams(allocator); |
| 19 | defer search.deinit(); |
| 20 | try expect(search.get("title")).toEqualString("URL"); |
| 21 | } |