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:
parent
539b89075a
commit
79b242260b
2 changed files with 7 additions and 1 deletions
2
parse.y
2
parse.y
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;")}
|
||||
|
|
Loading…
Reference in a new issue