Project

General

Profile

Feature #11583 ยป file-unlink.patch

ksss (Yuki Kurihara), 10/12/2015 04:28 AM

View differences:

file.c
return LONG2FIX(n);
}
static VALUE
rb_file_unlink(VALUE obj)
{
rb_io_t *fptr;
const char *s;
GetOpenFile(obj, fptr);
s = RSTRING_PTR(fptr->pathv);
unlink_internal(s, fptr->pathv, 0);
return Qnil;
}
/*
* call-seq:
* File.rename(old_name, new_name) -> 0
......
rb_define_method(rb_cFile, "truncate", rb_file_truncate, 1);
rb_define_method(rb_cFile, "flock", rb_file_flock, 1);
rb_define_method(rb_cFile, "unlink", rb_file_unlink, 0);
/*
* Document-module: File::Constants
test/ruby/test_file_exhaustive.rb
assert_equal(1, File.unlink(regular_file))
make_file("foo", regular_file)
assert_raise(Errno::ENOENT) { File.unlink(nofile) }
assert_equal(nil, File.open(regular_file){|f| f.unlink})
assert_file.not_exist?(regular_file)
make_file("foo", regular_file)
assert_raise(Errno::ENOENT) { File.open(regular_file){|f| f.unlink; f.unlink} }
assert_file.not_exist?(regular_file)
make_file("foo", regular_file)
end
def test_rename
    (1-1/1)