Skip to content

Commit 276dbde

Browse files
committed
Add spec aliasing the same global variables twice
1 parent c700bcb commit 276dbde

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

spec/ruby/language/alias_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,4 +255,9 @@ def test_with_check(*args)
255255
code = '$a = 1; $b = 2; alias $b $a; p [$a, $b]; $b = 3; p [$a, $b]'
256256
ruby_exe(code).should == "[1, 1]\n[3, 3]\n"
257257
end
258+
259+
it "supports aliasing twice the same global variables" do
260+
code = '$a = 1; alias $b $a; alias $b $a; p [$a, $b]'
261+
ruby_exe(code).should == "[1, 1]\n"
262+
end
258263
end

spec/tags/language/alias_tags.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
slow:The alias keyword on top level defines the alias on Object
22
slow:The alias keyword can create a new global variable, synonym of the original
33
slow:The alias keyword can override an existing global variable and make them synonyms
4+
slow:The alias keyword supports aliasing twice the same global variables

0 commit comments

Comments
 (0)