Sha256: 0c7d124bd23cb7e81f55bb61b1756939a824a29f335087ffbc9f887d16235f51
Contents?: true
Size: 926 Bytes
Versions: 10
Compression:
Stored size: 926 Bytes
Contents
module File::Write def touch(*files) files.each do |file| File.open(file, "w") do |f| end end end def write(path, data) File.open(path, "w+") do |file| file.write(data) end path end end File.extend File::Write module File::Write::Etest TESTFILE = "#{__FILE__}.test" def test_touches assert !File.exist?(TESTFILE) File.touch TESTFILE assert File.exist?(TESTFILE) File.touch TESTFILE assert File.exist?(TESTFILE) File.unlink TESTFILE assert !File.exist?(TESTFILE) end def test_writes assert !File.exist?(TESTFILE) File.write TESTFILE, "blabber" assert_equal("blabber", File.read(TESTFILE)) File.write TESTFILE, "bla" assert_equal("bla", File.read(TESTFILE)) File.write TESTFILE, "" assert_equal("", File.read(TESTFILE)) File.unlink TESTFILE assert !File.exist?(TESTFILE) end end if VEX_TEST == "base"
Version data entries
10 entries across 10 versions & 1 rubygems