diff options
| author | Jenny Shen <jenny.shen@shopify.com> | 2024-02-02 16:57:51 -0500 |
|---|---|---|
| committer | Kevin Newton <kddnewton@gmail.com> | 2024-02-05 10:27:58 -0500 |
| commit | b35cdb4758c0a569574a047bda6ce6a19c302aef (patch) | |
| tree | 4e5fdcfe8511f92dbf803f3ea9ae372f49a82f28 /test/ruby | |
| parent | 8ed26a3f5923a0f1213060200bf542f172c99b7c (diff) | |
[PRISM] Implement opt_aset_with
Part of ruby/prism#2231
Co-authored-by: Adrianna Chang <adrianna.chang@shopify.com>
Co-authored-by: Peter Zhu <peter@peterzhu.ca>
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_compile_prism.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb index b9c8d1bb5b..e70c73c30a 100644 --- a/test/ruby/test_compile_prism.rb +++ b/test/ruby/test_compile_prism.rb @@ -2076,6 +2076,18 @@ end before == after RUBY + + # Test opt_aset_with instruction when calling []= with a string key + assert_prism_eval(<<~RUBY) + ObjectSpace.count_objects + + h = {"abc" => 1} + before = ObjectSpace.count_objects[:T_STRING] + 5.times{ h["abc"] = 2} + after = ObjectSpace.count_objects[:T_STRING] + + before == after + RUBY end def test_CallAndWriteNode |
