Project

General

Profile

Bug #15267 ยป file-basename-trailing-dot-15267.patch

jeremyevans0 (Jeremy Evans), 08/13/2019 11:48 PM

View differences:

file.c
for (e = 0; q - p < n; Inc(q, end, enc)) {
if (*q == '.') e = q;
}
if (e) f = e - p;
if (e) {
f = e - p;
if (*(e+1) == '\0') f++;
}
else f = n;
}
test/ruby/test_file_exhaustive.rb
assert_equal("foo", File.basename("foo", ".ext"))
assert_equal("foo", File.basename("foo.ext", ".ext"))
assert_equal("foo", File.basename("foo.ext", ".*"))
assert_equal("foo.", File.basename("foo.", ".*"))
end
if NTFS
......
assert_equal(basename + " ", File.basename(file + " ", ".test"))
assert_equal(basename + ".", File.basename(file + ".", ".test"))
assert_equal(basename + "::$DATA", File.basename(file + "::$DATA", ".test"))
assert_equal(basename, File.basename(file + ".", ".*"))
assert_equal(basename + '.', File.basename(file + ".", ".*"))
basename.chomp!(".test")
assert_equal(basename, File.basename(file + " ", ".*"))
assert_equal(basename, File.basename(file + "::$DATA", ".*"))
    (1-1/1)