1
0
Fork 0
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:
Nobuyoshi Nakada 2021-08-15 01:33:31 +09:00
parent 4568ba0711
commit 2aa6826e81
Notes: git 2021-08-15 11:40:34 +09:00
2 changed files with 10 additions and 1 deletions

View file

@ -10791,7 +10791,7 @@ parser_token_value_print(struct parser_params *p, enum yytokentype type, const Y
#ifndef RIPPER
v = valp->node->nd_lit;
#else
v = valp->val;
v = get_value(valp->val);
#endif
rb_parser_printf(p, "%+"PRIsVALUE, v);
break;

View file

@ -75,6 +75,15 @@ class TestRipper::Ripper < Test::Unit::TestCase
assert_include out.string[/.*"local variable or method".*/], 'test_xxxx'
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
bug11932 = '[ruby-core:72638] [Bug #11932]'
src = '/[\xC0-\xF0]/u'.dup.force_encoding(Encoding::UTF_8)