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