Check the encoding of ruby2_keywords_flag
[Bug #18184]
This commit is contained in:
parent
357406da8b
commit
552728a23a
@ -1422,6 +1422,7 @@ ruby2_keywords_flag_check(VALUE sym)
|
||||
{
|
||||
const char *p;
|
||||
long l;
|
||||
if (rb_enc_get_index(sym) != ENCINDEX_US_ASCII) return 0;
|
||||
RSTRING_GETMEM(sym, p, l);
|
||||
if (l <= 0) return 0;
|
||||
if (name_equal(name_s_ruby2_keywords_flag, rb_strlen_lit(name_s_ruby2_keywords_flag), p, l)) {
|
||||
|
@ -810,7 +810,11 @@ class TestMarshal < Test::Unit::TestCase
|
||||
hash = Marshal.load(data)
|
||||
assert_equal(42, ruby2_keywords_test(*[hash]))
|
||||
|
||||
hash2 = Marshal.load(data.sub!(/\x06K(?=T\z)/, "\x08KEY"))
|
||||
hash2 = Marshal.load(data.sub(/\x06K(?=T\z)/, "\x08KEY"))
|
||||
assert_raise(ArgumentError, /\(given 1, expected 0\)/) {
|
||||
ruby2_keywords_test(*[hash2])
|
||||
}
|
||||
hash2 = Marshal.load(data.sub(/:\x06K(?=T\z)/, "I\\&\x06:\x0dencoding\"\x0dUTF-16LE"))
|
||||
assert_raise(ArgumentError, /\(given 1, expected 0\)/) {
|
||||
ruby2_keywords_test(*[hash2])
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user