mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Check the encoding of half:
option
This commit is contained in:
parent
af899503a6
commit
1ddc719a56
2 changed files with 4 additions and 0 deletions
|
@ -233,6 +233,7 @@ rb_num_get_rounding_option(VALUE opts)
|
|||
str = rb_check_string_type(rounding);
|
||||
if (NIL_P(str)) goto invalid;
|
||||
}
|
||||
rb_must_asciicompat(str);
|
||||
s = RSTRING_PTR(str);
|
||||
switch (RSTRING_LEN(str)) {
|
||||
case 2:
|
||||
|
|
|
@ -764,6 +764,9 @@ class TestFloat < Test::Unit::TestCase
|
|||
assert_raise_with_message(ArgumentError, /xxx/) {
|
||||
1.0.round(half: "\0xxx")
|
||||
}
|
||||
assert_raise_with_message(Encoding::CompatibilityError, /ASCII incompatible/) {
|
||||
1.0.round(half: "up".force_encoding("utf-16be"))
|
||||
}
|
||||
end
|
||||
|
||||
def test_Float
|
||||
|
|
Loading…
Add table
Reference in a new issue