[前][次][番号順一覧][スレッド一覧]

ruby-changes:8452

From: usa <ko1@a...>
Date: Tue, 28 Oct 2008 12:52:55 +0900 (JST)
Subject: [ruby-changes:8452] Ruby:r19984 (trunk): * test/ruby/test_file.rb (test_each_char_extended_file,

usa	2008-10-28 12:52:43 +0900 (Tue, 28 Oct 2008)

  New Revision: 19984

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19984

  Log:
    * test/ruby/test_file.rb (test_each_char_extended_file,
      test_getbyte_extended_file): add tests.

  Modified files:
    trunk/test/ruby/test_file.rb

Index: test/ruby/test_file.rb
===================================================================
--- test/ruby/test_file.rb	(revision 19983)
+++ test/ruby/test_file.rb	(revision 19984)
@@ -85,6 +85,15 @@
     assert_equal("a", f.gets(""))
   end
 
+  def test_each_char_extended_file
+    f = Tempfile.new("test-extended-file")
+    assert_nil(f.getc)
+    open(f.path, "w") {|g| g.print "a" }
+    result = []
+    f.each_char {|b| result << b }
+    assert_equal([?a], result)
+  end
+
   def test_each_byte_extended_file
     f = Tempfile.new("test-extended-file")
     assert_nil(f.getc)
@@ -101,6 +110,13 @@
     assert_equal(?a, f.getc)
   end
 
+  def test_getbyte_extended_file
+    f = Tempfile.new("test-extended-file")
+    assert_nil(f.getc)
+    open(f.path, "w") {|g| g.print "a" }
+    assert_equal(?a, f.getbyte.chr)
+  end
+
   def test_s_chown
     assert_nothing_raised { File.chown -1, -1 }
     assert_nothing_raised { File.chown nil, nil }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]