Commit 337762114f

Jon Parise <jon@indelible.org>
2025-10-13 15:17:26
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.
1 parent d18f1dd
Changed files (1)
lib
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" {