summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--test/ruby/test_file.rb32
-rw-r--r--test/soap/marshal/test_digraph.rb2
3 files changed, 41 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index b48a1d28cc..c0420cba42 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Mon Sep 27 04:57:07 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/ruby/test_file.rb: new file. only asserts unlink-before-close
+ behaviour now.
+
+ * test/soap/marshal/test_digraph.rb: should close before unlink.
+ unlink-before-close pattern is not needed here.
+
Mon Sep 27 03:32:37 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* test/soap/*, test/wsdl/*, test/xsd/*: move TestCase classes into
diff --git a/test/ruby/test_file.rb b/test/ruby/test_file.rb
new file mode 100644
index 0000000000..d0ba276d33
--- /dev/null
+++ b/test/ruby/test_file.rb
@@ -0,0 +1,32 @@
+require 'test/unit'
+
+$KCODE = 'none'
+
+class TestFile < Test::Unit::TestCase
+
+ # I don't know Ruby's spec about "unlink-before-close" exactly.
+ # This test asserts current behaviour.
+ def test_unlink_before_close
+ filename = File.basename(__FILE__) + ".#{$$}"
+ w = File.open(filename, "w")
+ w << "foo"
+ w.close
+ r = File.open(filename, "r")
+ begin
+ if /(mswin|bccwin|mingw)/ =~ RUBY_PLATFORM
+ begin
+ File.unlink(filename)
+ assert(false)
+ rescue Errno::EACCES
+ assert(true)
+ end
+ else
+ File.unlink(filename)
+ assert(true)
+ end
+ ensure
+ r.close
+ File.unlink(filename) if File.exist?(filename)
+ end
+ end
+end
diff --git a/test/soap/marshal/test_digraph.rb b/test/soap/marshal/test_digraph.rb
index 2e79589dc4..c83238748a 100644
--- a/test/soap/marshal/test_digraph.rb
+++ b/test/soap/marshal/test_digraph.rb
@@ -36,7 +36,7 @@ class TestDigraph < Test::Unit::TestCase
f = File.open("digraph_marshalled_string.soap", "wb")
SOAP::Marshal.dump(@n1, f)
f.close
- str = File.open("digraph_marshalled_string.soap").read
+ str = File.read("digraph_marshalled_string.soap")
newnode = SOAP::Marshal.unmarshal(str)
assert_equal(newnode.first.first.__id__, newnode.second.first.__id__)
assert_equal(newnode.first.first.first.first.__id__, newnode.second.first.second.first.__id__)