summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-01-10 09:59:11 +0000
committeraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-01-10 09:59:11 +0000
commit2785c7c05ff7c4c0af591b38530fdddac96a52d0 (patch)
treebfbcc33481054ad2ec1533e2ac3a5cf7129038be /test
parentd158c316839252f07519ffc9448614fc4b7a3588 (diff)
* ext/strscan/strscan.c (strscan_do_scan): should set kcode option before match. [ruby-dev:29914]
* test/strscan/test_stringscanner.rb: test it. * re.c: export kcode_set_option and kcode_reset_option (with "rb_" prefix). * intern.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/strscan/test_stringscanner.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/strscan/test_stringscanner.rb b/test/strscan/test_stringscanner.rb
index 5b0fd53..75e96c0 100644
--- a/test/strscan/test_stringscanner.rb
+++ b/test/strscan/test_stringscanner.rb
@@ -247,6 +247,19 @@ class TestStringScanner < Test::Unit::TestCase
s = StringScanner.new("")
assert_equal "", s.scan(//)
assert_equal "", s.scan(//)
+
+ # [ruby-dev:29914]
+ %w( NONE EUC SJIS UTF8 ).each do |kcode|
+ begin
+ $KCODE = kcode
+ assert_equal "a", StringScanner.new("a:b").scan(/[^\x01\:]+/n)
+ assert_equal "a", StringScanner.new("a:b").scan(/[^\x01\:]+/e)
+ assert_equal "a", StringScanner.new("a:b").scan(/[^\x01\:]+/s)
+ assert_equal "a", StringScanner.new("a:b").scan(/[^\x01\:]+/u)
+ ensure
+ $KCODE = 'NONE'
+ end
+ end
end
def test_skip