diff options
author | Shugo Maeda <shugo@ruby-lang.org> | 2021-09-11 22:03:10 +0900 |
---|---|---|
committer | Shugo Maeda <shugo@ruby-lang.org> | 2021-09-11 22:03:10 +0900 |
commit | 7686776c0563eeb269c5ffa1fc2cf42d4d31e222 (patch) | |
tree | ff38fc5ffa22b3d4fb67baccc48bb9350516f29a /test/ripper/test_sexp.rb | |
parent | 8d0315a2bbda2cdefeaf00ff1edcd90384d8951a (diff) | |
download | ruby-7686776c0563eeb269c5ffa1fc2cf42d4d31e222.tar.gz |
Hash values should be omitted in Ripper results
Diffstat (limited to 'test/ripper/test_sexp.rb')
-rw-r--r-- | test/ripper/test_sexp.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ripper/test_sexp.rb b/test/ripper/test_sexp.rb index b4e70fa4f5..9faeaba782 100644 --- a/test/ripper/test_sexp.rb +++ b/test/ripper/test_sexp.rb @@ -520,4 +520,18 @@ eot assert_raise(SyntaxError) { Ripper.sexp('def req(true) end', raise_errors: true) } assert_raise(SyntaxError) { Ripper.sexp_raw('def req(true) end', raise_errors: true) } end + + def test_hash_value_omission + sexp = Ripper.sexp("{x: 1, y:}") + assoclist = search_sexp(:assoclist_from_args, sexp) + x = assoclist[1][0] + assert_equal(:@label, x[1][0]) + assert_equal("x:", x[1][1]) + assert_equal(:@int, x[2][0]) + assert_equal("1", x[2][1]) + y = assoclist[1][1] + assert_equal(:@label, y[1][0]) + assert_equal("y:", y[1][1]) + assert_equal(nil, y[2]) + end end if ripper_test |