From dab5bb9247b5e3454a221d62e3fe6f9580d5ab0b Mon Sep 17 00:00:00 2001 From: Evin Yulo Date: Wed, 21 Sep 2022 22:55:38 +0000 Subject: [PATCH] Fix docstring for std.fs.path.extension --- lib/std/fs/path.zig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/std/fs/path.zig b/lib/std/fs/path.zig index 9dc33676888d59cfd845b450c75024ff183c14bd..d5ba5fe909a2fa5e55b22fc3b68e4688f0d0ebd0 100644 --- a/lib/std/fs/path.zig +++ b/lib/std/fs/path.zig @@ -1271,11 +1271,13 @@ fn testRelativeWindows(from: []const u8, to: []const u8, expected_output: []cons /// Returns the extension of the file name (if any). /// This function will search for the file extension (separated by a `.`) and will return the text after the `.`. -/// Files that end with `.` are considered to have no extension, files that start with `.` +/// Files that end with `.`, or that start with `.` and have no other `.` in their name, +/// are considered to have no extension. /// Examples: /// - `"main.zig"` ⇒ `".zig"` /// - `"src/main.zig"` ⇒ `".zig"` /// - `".gitignore"` ⇒ `""` +/// - `".image.png"` ⇒ `".png"` /// - `"keep."` ⇒ `"."` /// - `"src.keep.me"` ⇒ `".me"` /// - `"/src/keep.me"` ⇒ `".me"` @@ -1301,6 +1303,7 @@ test "extension" { try testExtension(".a", ""); try testExtension(".file", ""); try testExtension(".gitignore", ""); + try testExtension(".image.png", ".png"); try testExtension("file.ext", ".ext"); try testExtension("file.ext.", "."); try testExtension("very-long-file.bruh", ".bruh"); -- 2.54.0