summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-21 06:37:18 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-21 06:37:18 +0000
commit4131d6176ac46da95b1e7fa045651783f0a66c65 (patch)
tree183d949381d2319ad4fe8471f2632f8e86839ca2 /test
parent2976ec58a48e3ff83ff3d0979041bb5694592153 (diff)
* io.c (io_getc): fix incomplete character immediately before EOF
with newline converter. [ruby-dev:41024] run test only when "Create Shortcut (&S)" menu is found. * lib/rexml/parsers/xpathparser.rb (PathExpr): ditto. * lib/matrix.rb (Vector#each): make Vector enumerable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_io_m17n.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb
index 04c97c61b2..737eebb3e9 100644
--- a/test/ruby/test_io_m17n.rb
+++ b/test/ruby/test_io_m17n.rb
@@ -400,6 +400,25 @@ EOT
}
end
+ def test_getc_newlineconv_invalid
+ with_tmpdir {
+ src = "\xE3\x81"
+ generate_file('tmp', src)
+ defext = Encoding.default_external
+ Encoding.default_external = Encoding::UTF_8
+ open("tmp", "rt") {|f|
+ p f.read;f.rewind
+ s = f.getc
+ assert_equal(false, s.valid_encoding?)
+ assert_equal("\xE3".force_encoding("UTF-8"), s)
+ s = f.getc
+ assert_equal(false, s.valid_encoding?)
+ assert_equal("\x81".force_encoding("UTF-8"), s)
+ }
+ Encoding.default_external = defext
+ }
+ end
+
def test_ungetc_stateful_conversion
with_tmpdir {
src = "before \e$B\x23\x30\x23\x31\e(B after".force_encoding("iso-2022-jp")