diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-05-27 21:55:02 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-05-27 21:55:02 +0000 |
commit | ead40959357817c0937553a45208ef748975e340 (patch) | |
tree | 307b315a455953e97bd86cf2bfdc5d53a04cf581 /spec/rubyspec/language/alias_spec.rb | |
parent | 24db428785c938d401c9e582b5ea2622540222ad (diff) |
Update to ruby/spec@2795010
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/rubyspec/language/alias_spec.rb')
-rw-r--r-- | spec/rubyspec/language/alias_spec.rb | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/spec/rubyspec/language/alias_spec.rb b/spec/rubyspec/language/alias_spec.rb index 626e37a603..e9f0050e17 100644 --- a/spec/rubyspec/language/alias_spec.rb +++ b/spec/rubyspec/language/alias_spec.rb @@ -24,6 +24,62 @@ describe "The alias keyword" do @obj.__value.should == 5 end + it "works with a simple symbol on the left-hand side" do + @meta.class_eval do + alias :a value + end + @obj.a.should == 5 + end + + it "works with a single quoted symbol on the left-hand side" do + @meta.class_eval do + alias :'a' value + end + @obj.a.should == 5 + end + + it "works with a doubule quoted symbol on the left-hand side" do + @meta.class_eval do + alias :"a" value + end + @obj.a.should == 5 + end + + it "works with an interoplated symbol on the left-hand side" do + @meta.class_eval do + alias :"#{'a'}" value + end + @obj.a.should == 5 + end + + it "works with a simple symbol on the right-hand side" do + @meta.class_eval do + alias a :value + end + @obj.a.should == 5 + end + + it "works with a single quoted symbol on the right-hand side" do + @meta.class_eval do + alias a :'value' + end + @obj.a.should == 5 + end + + it "works with a doubule quoted symbol on the right-hand side" do + @meta.class_eval do + alias a :"value" + end + @obj.a.should == 5 + end + + it "works with an interoplated symbol on the right-hand side" do + @meta.class_eval do + alias a :"#{'value'}" + end + @obj.a.should == 5 + end + it "adds the new method to the list of methods" do original_methods = @obj.methods @meta.class_eval do |