diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-01-27 13:12:39 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-01-27 13:12:39 +0000 |
commit | 42921458ff7eacd1ef614c3e67596c75ccd0a1d4 (patch) | |
tree | 710c40988e51715f84a12c3295162b1c5697bf51 /spec/ruby/core/proc/shared | |
parent | a53ee2136ff59ebc54ae6c98a500765bc3d13d44 (diff) |
Update to ruby/spec@e57f49c
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66929 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/core/proc/shared')
-rw-r--r-- | spec/ruby/core/proc/shared/to_s.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/spec/ruby/core/proc/shared/to_s.rb b/spec/ruby/core/proc/shared/to_s.rb index 530eaff3a0..46b21dd083 100644 --- a/spec/ruby/core/proc/shared/to_s.rb +++ b/spec/ruby/core/proc/shared/to_s.rb @@ -32,14 +32,24 @@ describe :proc_to_s, shared: true do describe "for a proc created with UnboundMethod#to_proc" do it "returns a description including '(lambda)' and optionally including file and line number" do def hello; end - method("hello").to_proc.send(@method).should =~ /^#<Proc:([^ ]*?)(@([^ ]*)\/to_s\.rb:22)? \(lambda\)>$/ end it "has an ASCII-8BIT encoding" do def hello; end - method("hello").to_proc.send(@method).encoding.should == Encoding::ASCII_8BIT end end + + describe "for a proc created with Symbol#to_proc" do + it "returns a description including '(&:symbol)'" do + proc = :foobar.to_proc + proc.send(@method).should =~ /^#<Proc:0x\h+\(&:foobar\)>$/ + end + + it "has an ASCII-8BIT encoding" do + proc = :foobar.to_proc + proc.send(@method).encoding.should == Encoding::ASCII_8BIT + end + end end |