zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit dab5bb9247b5e3454a221d62e3fe6f9580d5ab0b (tree)
parent 0e4b04672c000220ef47894086100610a9d6d9c3
Author: Evin Yulo <yujiri@disroot.org>
Date:   Wed, 21 Sep 2022 22:55:38 +0000

Fix docstring for std.fs.path.extension

Diffstat:
Mlib/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 @@ -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");