Project

General

Profile

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

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

View differences:

file.c
4527 4527
	for (e = 0; q - p < n; Inc(q, end, enc)) {
4528 4528
	    if (*q == '.') e = q;
4529 4529
	}
4530
	if (e) f = e - p;
4530
        if (e) {
4531
            f = e - p;
4532
            if (*(e+1) == '\0') f++;
4533
        }
4531 4534
	else f = n;
4532 4535
    }
4533 4536

  
test/ruby/test_file_exhaustive.rb
1227 1227
    assert_equal("foo", File.basename("foo", ".ext"))
1228 1228
    assert_equal("foo", File.basename("foo.ext", ".ext"))
1229 1229
    assert_equal("foo", File.basename("foo.ext", ".*"))
1230
    assert_equal("foo.", File.basename("foo.", ".*"))
1230 1231
  end
1231 1232

  
1232 1233
  if NTFS
......
1255 1256
        assert_equal(basename + " ", File.basename(file + " ", ".test"))
1256 1257
        assert_equal(basename + ".", File.basename(file + ".", ".test"))
1257 1258
        assert_equal(basename + "::$DATA", File.basename(file + "::$DATA", ".test"))
1258
        assert_equal(basename, File.basename(file + ".", ".*"))
1259
        assert_equal(basename + '.', File.basename(file + ".", ".*"))
1259 1260
        basename.chomp!(".test")
1260 1261
        assert_equal(basename, File.basename(file + " ", ".*"))
1261 1262
        assert_equal(basename, File.basename(file + "::$DATA", ".*"))
1262
-