| ... | ... | @@ -1887,8 +1887,8 @@ test extension { |
| 1887 | 1887 | /// - "hello/world/lib" ⇒ "lib" |
| 1888 | 1888 | pub fn stem(path: []const u8) []const u8 { |
| 1889 | 1889 | const filename = basename(path); |
| 1890 | | const index = mem.findScalarLast(u8, filename, '.') orelse return filename[0..]; |
| 1891 | | if (index == 0) return path; |
| 1890 | const index = mem.findScalarLast(u8, filename, '.') orelse return filename; |
| 1891 | if (index == 0) return filename; |
| 1892 | 1892 | return filename[0..index]; |
| 1893 | 1893 | } |
| 1894 | 1894 | |
| ... | ... | @@ -1904,8 +1904,14 @@ test stem { |
| 1904 | 1904 | try testStem("hello...", "hello.."); |
| 1905 | 1905 | try testStem("hello.", "hello"); |
| 1906 | 1906 | try testStem("/hello.", "hello"); |
| 1907 | try testStem("hello/world/.gitignore", ".gitignore"); |
| 1908 | try testStem("/.gitignore", ".gitignore"); |
| 1907 | 1909 | try testStem(".gitignore", ".gitignore"); |
| 1910 | try testStem(".gitignore/", ".gitignore"); |
| 1911 | try testStem("hello/world/.image.png", ".image"); |
| 1912 | try testStem("/.image.png", ".image"); |
| 1908 | 1913 | try testStem(".image.png", ".image"); |
| 1914 | try testStem(".image.png/", ".image"); |
| 1909 | 1915 | try testStem("file.ext", "file"); |
| 1910 | 1916 | try testStem("file.ext.", "file.ext"); |
| 1911 | 1917 | try testStem("a.b.c", "a.b"); |