1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Ignore useless separators preceding a file encoding comment

This commit is contained in:
Nobuyoshi Nakada 2021-03-23 17:20:19 +09:00
parent a58f9aa350
commit 607aa11711
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6
2 changed files with 9 additions and 0 deletions

View file

@ -8274,6 +8274,7 @@ set_file_encoding(struct parser_params *p, const char *str, const char *send)
continue;
}
if (STRNCASECMP(str-6, "coding", 6) == 0) break;
sep = 0;
}
for (;;) {
do {

View file

@ -692,6 +692,14 @@ x = __ENCODING__
x = __ENCODING__
END
end
assert_nothing_raised do
eval <<-END, nil, __FILE__, __LINE__+1
# xxxx : coding sjis
x = __ENCODING__
END
end
assert_equal(__ENCODING__, x)
end
def test_utf8_bom