From 337762114f575824a1ab793dca41a3d073aa17cd Mon Sep 17 00:00:00 2001 From: Jon Parise Date: Mon, 13 Oct 2025 09:17:26 -0400 Subject: [PATCH] std.Uri: test file URIs without an authority field Some environments (such as KDE) form file URIs without an authority field (e.g. file:/etc/fstab). Also test this case for completeness. --- lib/std/Uri.zig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/std/Uri.zig b/lib/std/Uri.zig index 54e0f6a4f26b60a4cf7574125dacd5fc973049c2..d3df0491bbe509c8c1e7b960ada8d3dcbd444ecf 100644 --- a/lib/std/Uri.zig +++ b/lib/std/Uri.zig @@ -586,6 +586,11 @@ test "file" { try std.testing.expectEqualStrings("file", parsed3.scheme); try std.testing.expectEqualStrings("localhost", parsed3.host.?.percent_encoded); try std.testing.expectEqualStrings("/an/absolute/path/to/another/thing/", parsed3.path.percent_encoded); + + const parsed4 = try parse("file:/an/absolute/path"); + try std.testing.expectEqualStrings("file", parsed4.scheme); + try std.testing.expectEqual(@as(?Component, null), parsed4.host); + try std.testing.expectEqualStrings("/an/absolute/path", parsed4.path.percent_encoded); } test "scheme" { -- 2.54.0