diff options
| author | Takashi Kokubun <takashikkbn@gmail.com> | 2025-02-13 17:53:11 -0800 |
|---|---|---|
| committer | Takashi Kokubun <takashikkbn@gmail.com> | 2025-02-13 17:53:11 -0800 |
| commit | 698f808cc78b01bc23ff893eaabcc09a454b56ee (patch) | |
| tree | 5a419b1d9f1282558052bc8437bcad3f3db39fb8 /test/ruby/test_variable.rb | |
| parent | 82f7cb794109794f6ffa95ffb3be8e5149dd74bd (diff) | |
merge revision(s) 5fec9308320e8b377681ef19b0cd46d53f94e8ac, 1a06bee027d5c5b65ed0aaee76ee0040554d4efd: [Backport #20992]
[Bug #20992] Test for local variable name encodings
Do not intern invalid symbols in eval parse
When the inner code cannot represent the name of the locals in the
outer code, do not bother putting them into the constant pool as
they will not be referenced.
Fixes [Bug #20992]
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
Diffstat (limited to 'test/ruby/test_variable.rb')
| -rw-r--r-- | test/ruby/test_variable.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_variable.rb b/test/ruby/test_variable.rb index 86f2e4bb84..49fec2d40e 100644 --- a/test/ruby/test_variable.rb +++ b/test/ruby/test_variable.rb @@ -425,6 +425,13 @@ class TestVariable < Test::Unit::TestCase end end + def test_local_variables_encoding + α = 1 + b = binding + b.eval("".encode("us-ascii")) + assert_equal(%i[α b], b.local_variables) + end + private def with_kwargs_11(v1:, v2:, v3:, v4:, v5:, v6:, v7:, v8:, v9:, v10:, v11:) local_variables |
