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

ripper: Invalid pragma value warning

This commit is contained in:
Nobuyoshi Nakada 2020-11-02 22:48:28 +09:00
parent 539b89075a
commit 79b242260b
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6
2 changed files with 7 additions and 1 deletions

View file

@ -7926,7 +7926,7 @@ parser_get_bool(struct parser_params *p, const char *name, const char *val)
}
break;
}
rb_compile_warning(p->ruby_sourcefile, p->ruby_sourceline, "invalid value for %s: %s", name, val);
rb_warning2("invalid value for %s: %s", WARN_S(name), WARN_S(val));
return -1;
}

View file

@ -1588,6 +1588,12 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
assert_equal("frozen_string_literal", args[0])
end
def test_warning_invalid_magic_comment
fmt, *args = warning("#-*- frozen-string-literal: nottrue -*-")
assert_match(/invalid value/, fmt)
assert_equal(%w"frozen_string_literal nottrue", args)
end
def test_warn_cr_in_middle
fmt = nil
assert_warn("") {fmt, = warn("\r;")}