ruby-changes:3379
From: ko1@a...
Date: 3 Jan 2008 23:49:46 +0900
Subject: [ruby-changes:3379] akr - Ruby:r14872 (trunk): add a test for getc with stateful conversion.
akr 2008-01-03 23:49:38 +0900 (Thu, 03 Jan 2008) New Revision: 14872 Modified files: trunk/test/ruby/test_io_m17n.rb Log: add a test for getc with stateful conversion. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/ruby/test_io_m17n.rb?r1=14872&r2=14871&diff_format=u Index: test/ruby/test_io_m17n.rb =================================================================== --- test/ruby/test_io_m17n.rb (revision 14871) +++ test/ruby/test_io_m17n.rb (revision 14872) @@ -223,6 +223,17 @@ } end + def test_getc_stateful_conversion + with_tmpdir { + src = "\e$B\x23\x30\x23\x31\e(B".force_encoding("iso-2022-jp") + generate_file('tmp', src) + open("tmp", "r:iso-2022-jp:euc-jp") {|f| + assert_equal("\xa3\xb0".force_encoding("euc-jp"), f.getc) + assert_equal("\xa3\xb1".force_encoding("euc-jp"), f.getc) + } + } + end + def test_open_ascii with_tmpdir { src = "abc\n" -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml