mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Extract the wrapped value when yydebug [Bug #18075]
This commit is contained in:
parent
4568ba0711
commit
2aa6826e81
Notes:
git
2021-08-15 11:40:34 +09:00
2 changed files with 10 additions and 1 deletions
2
parse.y
2
parse.y
|
@ -10791,7 +10791,7 @@ parser_token_value_print(struct parser_params *p, enum yytokentype type, const Y
|
||||||
#ifndef RIPPER
|
#ifndef RIPPER
|
||||||
v = valp->node->nd_lit;
|
v = valp->node->nd_lit;
|
||||||
#else
|
#else
|
||||||
v = valp->val;
|
v = get_value(valp->val);
|
||||||
#endif
|
#endif
|
||||||
rb_parser_printf(p, "%+"PRIsVALUE, v);
|
rb_parser_printf(p, "%+"PRIsVALUE, v);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -75,6 +75,15 @@ class TestRipper::Ripper < Test::Unit::TestCase
|
||||||
assert_include out.string[/.*"local variable or method".*/], 'test_xxxx'
|
assert_include out.string[/.*"local variable or method".*/], 'test_xxxx'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_yydebug_string
|
||||||
|
out = StringIO.new
|
||||||
|
ripper = Ripper.new '"woot"'
|
||||||
|
ripper.yydebug = true
|
||||||
|
ripper.debug_output = out
|
||||||
|
ripper.parse
|
||||||
|
assert_include out.string[/.*"literal content".*/], 'woot'
|
||||||
|
end
|
||||||
|
|
||||||
def test_regexp_with_option
|
def test_regexp_with_option
|
||||||
bug11932 = '[ruby-core:72638] [Bug #11932]'
|
bug11932 = '[ruby-core:72638] [Bug #11932]'
|
||||||
src = '/[\xC0-\xF0]/u'.dup.force_encoding(Encoding::UTF_8)
|
src = '/[\xC0-\xF0]/u'.dup.force_encoding(Encoding::UTF_8)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue