authorgravatar for yujiri@disroot.orgEvin Yulo <yujiri@disroot.org> 2022-09-21 22:55:38+00:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-09-22 20:13:09-04:00
logdab5bb9247b5e3454a221d62e3fe6f9580d5ab0b
treebc61de2fcf262602f8c70a03fe5a9f37d7e2771d
parent0e4b04672c000220ef47894086100610a9d6d9c3

Fix docstring for std.fs.path.extension


1 files changed, 4 insertions(+), 1 deletions(-)

lib/std/fs/path.zig+4-1
...@@ -1271,11 +1271,13 @@ fn testRelativeWindows(from: []const u8, to: []const u8, expected_output: []cons...@@ -1271,11 +1271,13 @@ fn testRelativeWindows(from: []const u8, to: []const u8, expected_output: []cons
12711271
1272/// Returns the extension of the file name (if any).1272/// Returns the extension of the file name (if any).
1273/// This function will search for the file extension (separated by a `.`) and will return the text after the `.`.1273/// This function will search for the file extension (separated by a `.`) and will return the text after the `.`.
1274/// Files that end with `.` are considered to have no extension, files that start with `.`1274/// Files that end with `.`, or that start with `.` and have no other `.` in their name,
1275/// are considered to have no extension.
1275/// Examples:1276/// Examples:
1276/// - `"main.zig"` ⇒ `".zig"`1277/// - `"main.zig"` ⇒ `".zig"`
1277/// - `"src/main.zig"` ⇒ `".zig"`1278/// - `"src/main.zig"` ⇒ `".zig"`
1278/// - `".gitignore"` ⇒ `""`1279/// - `".gitignore"` ⇒ `""`
1280/// - `".image.png"` ⇒ `".png"`
1279/// - `"keep."` ⇒ `"."`1281/// - `"keep."` ⇒ `"."`
1280/// - `"src.keep.me"` ⇒ `".me"`1282/// - `"src.keep.me"` ⇒ `".me"`
1281/// - `"/src/keep.me"` ⇒ `".me"`1283/// - `"/src/keep.me"` ⇒ `".me"`
...@@ -1301,6 +1303,7 @@ test "extension" {...@@ -1301,6 +1303,7 @@ test "extension" {
1301 try testExtension(".a", "");1303 try testExtension(".a", "");
1302 try testExtension(".file", "");1304 try testExtension(".file", "");
1303 try testExtension(".gitignore", "");1305 try testExtension(".gitignore", "");
1306 try testExtension(".image.png", ".png");
1304 try testExtension("file.ext", ".ext");1307 try testExtension("file.ext", ".ext");
1305 try testExtension("file.ext.", ".");1308 try testExtension("file.ext.", ".");
1306 try testExtension("very-long-file.bruh", ".bruh");1309 try testExtension("very-long-file.bruh", ".bruh");