| ... | ... | @@ -1271,11 +1271,13 @@ fn testRelativeWindows(from: []const u8, to: []const u8, expected_output: []cons |
| 1271 | 1271 | |
| 1272 | 1272 | /// Returns the extension of the file name (if any). |
| 1273 | 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 | 1276 | /// Examples: |
| 1276 | 1277 | /// - `"main.zig"` ⇒ `".zig"` |
| 1277 | 1278 | /// - `"src/main.zig"` ⇒ `".zig"` |
| 1278 | 1279 | /// - `".gitignore"` ⇒ `""` |
| 1280 | /// - `".image.png"` ⇒ `".png"` |
| 1279 | 1281 | /// - `"keep."` ⇒ `"."` |
| 1280 | 1282 | /// - `"src.keep.me"` ⇒ `".me"` |
| 1281 | 1283 | /// - `"/src/keep.me"` ⇒ `".me"` |
| ... | ... | @@ -1301,6 +1303,7 @@ test "extension" { |
| 1301 | 1303 | try testExtension(".a", ""); |
| 1302 | 1304 | try testExtension(".file", ""); |
| 1303 | 1305 | try testExtension(".gitignore", ""); |
| 1306 | try testExtension(".image.png", ".png"); |
| 1304 | 1307 | try testExtension("file.ext", ".ext"); |
| 1305 | 1308 | try testExtension("file.ext.", "."); |
| 1306 | 1309 | try testExtension("very-long-file.bruh", ".bruh"); |