Bug #15267 ยป file-basename-trailing-dot-15267.patch
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", ".*"))
|