mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test_numeric.rb: default_external
* test/ruby/test_numeric.rb (test_coerce): manage Encoding.default_external. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
251de3209b
commit
82ab2d6d6a
1 changed files with 13 additions and 4 deletions
|
@ -1,4 +1,5 @@
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
|
require_relative 'envutil'
|
||||||
|
|
||||||
class TestNumeric < Test::Unit::TestCase
|
class TestNumeric < Test::Unit::TestCase
|
||||||
class DummyNumeric < Numeric
|
class DummyNumeric < Numeric
|
||||||
|
@ -20,10 +21,18 @@ class TestNumeric < Test::Unit::TestCase
|
||||||
assert_raise_with_message(TypeError, /can't be coerced into /) {1|:foo}
|
assert_raise_with_message(TypeError, /can't be coerced into /) {1|:foo}
|
||||||
assert_raise_with_message(TypeError, /can't be coerced into /) {1^:foo}
|
assert_raise_with_message(TypeError, /can't be coerced into /) {1^:foo}
|
||||||
|
|
||||||
assert_raise_with_message(TypeError, /:\u{3042}/) {1+:"\u{3042}"}
|
EnvUtil.with_default_external(Encoding::UTF_8) do
|
||||||
assert_raise_with_message(TypeError, /:\u{3042}/) {1&:"\u{3042}"}
|
assert_raise_with_message(TypeError, /:\u{3042}/) {1+:"\u{3042}"}
|
||||||
assert_raise_with_message(TypeError, /:\u{3042}/) {1|:"\u{3042}"}
|
assert_raise_with_message(TypeError, /:\u{3042}/) {1&:"\u{3042}"}
|
||||||
assert_raise_with_message(TypeError, /:\u{3042}/) {1^:"\u{3042}"}
|
assert_raise_with_message(TypeError, /:\u{3042}/) {1|:"\u{3042}"}
|
||||||
|
assert_raise_with_message(TypeError, /:\u{3042}/) {1^:"\u{3042}"}
|
||||||
|
end
|
||||||
|
EnvUtil.with_default_external(Encoding::US_ASCII) do
|
||||||
|
assert_raise_with_message(TypeError, /:"\\u3042"/) {1+:"\u{3042}"}
|
||||||
|
assert_raise_with_message(TypeError, /:"\\u3042"/) {1&:"\u{3042}"}
|
||||||
|
assert_raise_with_message(TypeError, /:"\\u3042"/) {1|:"\u{3042}"}
|
||||||
|
assert_raise_with_message(TypeError, /:"\\u3042"/) {1^:"\u{3042}"}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_dummynumeric
|
def test_dummynumeric
|
||||||
|
|
Loading…
Add table
Reference in a new issue