Commit 51ea477b

51ea477b5728Merged

Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 1 file · +1 added

Description

Merge pull request #102 from notorious94/istiad/fix/issue#85

feat: add regression test for sym_array empty-then-push

Details

Commit
51ea477b5728
Parent
974ecdc06b31
Merge parent
05af0312042e

test/sym_array_empty_push.rbaddedView file

1+# Issue #85 / PR #92: an empty `[]` followed by `push(:sym)` should
2+# promote the local's tracked type to sym_array, so element access
3+# emits the symbol-name path instead of printing the symbol id.
4+# The literal-array form (`syms = [:tag, :more]`) was already passing
5+# on master before PR #92, so this test exercises empty-then-push.
6+
7+syms = []
8+syms.push(:tag)
9+syms.push(:more)
10+puts syms[0] # tag
11+puts syms[1] # more
12+puts syms.length # 2
13+
14+# `<<` form should behave the same.
15+syms2 = []
16+syms2 << :alpha
17+syms2 << :beta
18+puts syms2[0] # alpha
19+puts syms2[1] # beta