summaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-18 10:17:25 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-18 10:17:25 +0000
commitc7c1a7b8c1fc2f03506b41c9d1314aa35580a749 (patch)
tree44c7998b73236515cad121f5dde965ed669bfc41 /test/ruby
parent6f5c530ada2bb571458bef7cd8be8958c76f2737 (diff)
downloadruby-c7c1a7b8c1fc2f03506b41c9d1314aa35580a749.tar.gz
ruby-c7c1a7b8c1fc2f03506b41c9d1314aa35580a749.tar.xz
ruby-c7c1a7b8c1fc2f03506b41c9d1314aa35580a749.zip
fix test. [ruby-dev:32625].
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14296 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_m17n.rb15
1 files changed, 11 insertions, 4 deletions
diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb
index dedbaf5ec..9805fd052 100644
--- a/test/ruby/test_m17n.rb
+++ b/test/ruby/test_m17n.rb
@@ -804,16 +804,23 @@ class TestM17N < Test::Unit::TestCase
assert_raise(IndexError) { t[i] = s2 }
else
t[i] = s2
- if i == s1.length && s2.empty?
- assert_nil(t[i])
+ if !s1.valid_encoding? || !s2.valid_encoding?
+ assert(a(t).index(a(s2)))
else
- assert_equal(s2, t[i], "t = #{encinsp(s1)}; t[#{i}] = #{encinsp(s2)}; t[#{i}]")
+ if i == s1.length && s2.empty?
+ assert_nil(t[i])
+ elsif i < 0
+ assert_equal(s2, t[i-s2.length+1,s2.length],
+ "t = #{encinsp(s1)}; t[#{i}] = #{encinsp(s2)}; t[#{i-s2.length+1},#{s2.length}]")
+ else
+ assert_equal(s2, t[i,s2.length],
+ "t = #{encinsp(s1)}; t[#{i}] = #{encinsp(s2)}; t[#{i},#{s2.length}]")
+ end
end
end
else
assert_raise(ArgumentError) { t[i] = s2 }
end
-
}
}
}