summaryrefslogtreecommitdiff
path: root/spec/ruby/language
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2021-06-02 14:34:07 +0200
committerBenoit Daloze <eregontp@gmail.com>2021-06-02 14:34:07 +0200
commit22e2a6a999b958efe5d84d9c7314e450fda82254 (patch)
treeb2dc946cf2fe2c250d0583675e548c67dca3e71a /spec/ruby/language
parenta4fbc7e2884ba694278adea3b32ddb8c2ac10efe (diff)
Update to ruby/spec@a0b7d0d
Diffstat (limited to 'spec/ruby/language')
-rw-r--r--spec/ruby/language/fixtures/return.rb8
-rw-r--r--spec/ruby/language/hash_spec.rb15
-rw-r--r--spec/ruby/language/source_encoding_spec.rb4
3 files changed, 19 insertions, 8 deletions
diff --git a/spec/ruby/language/fixtures/return.rb b/spec/ruby/language/fixtures/return.rb
index 0414c356e8..f6b143f3fa 100644
--- a/spec/ruby/language/fixtures/return.rb
+++ b/spec/ruby/language/fixtures/return.rb
@@ -101,18 +101,14 @@ module ReturnSpecs
# return value will go into val before we run the ensure.
#
# If lamb's return keeps unwinding incorrectly, val will still
- # have it's old value.
+ # have its old value.
#
# We can therefore use val to figure out what happened.
begin
val = foo()
ensure
- if val != :good
- return :bad
- end
+ return val
end
-
- return val
end
end
diff --git a/spec/ruby/language/hash_spec.rb b/spec/ruby/language/hash_spec.rb
index afc0df12a2..9b2e5a2dc7 100644
--- a/spec/ruby/language/hash_spec.rb
+++ b/spec/ruby/language/hash_spec.rb
@@ -48,6 +48,21 @@ describe "Hash literal" do
}.should complain(/key :foo is duplicated|duplicated key/)
@h.keys.size.should == 1
@h.should == {foo: :foo}
+ -> {
+ @h = eval "{%q{a} => :bar, %q{a} => :foo}"
+ }.should complain(/key "a" is duplicated|duplicated key/)
+ @h.keys.size.should == 1
+ @h.should == {%q{a} => :foo}
+ -> {
+ @h = eval "{1000 => :bar, 1000 => :foo}"
+ }.should complain(/key 1000 is duplicated|duplicated key/)
+ @h.keys.size.should == 1
+ @h.should == {1000 => :foo}
+ -> {
+ @h = eval "{1.0 => :bar, 1.0 => :foo}"
+ }.should complain(/key 1.0 is duplicated|duplicated key/)
+ @h.keys.size.should == 1
+ @h.should == {1.0 => :foo}
end
it "accepts a hanging comma" do
diff --git a/spec/ruby/language/source_encoding_spec.rb b/spec/ruby/language/source_encoding_spec.rb
index a0a29f63de..19364fc676 100644
--- a/spec/ruby/language/source_encoding_spec.rb
+++ b/spec/ruby/language/source_encoding_spec.rb
@@ -29,7 +29,7 @@ describe "Source files" do
touch(path, "wb") { |f| f.write source }
begin
- ruby_exe(path, args: "2>&1").should =~ /invalid multibyte char/
+ ruby_exe(path, args: "2>&1", exit_status: 1).should =~ /invalid multibyte char/
ensure
rm_r path
end
@@ -51,7 +51,7 @@ describe "Source files" do
touch(path, "wb") { |f| f.write source }
begin
- ruby_exe(path, args: "2>&1").should =~ /invalid multibyte char/
+ ruby_exe(path, args: "2>&1", exit_status: 1).should =~ /invalid multibyte char/
ensure
rm_r path
end