Skip to content

Commit 5e81941

Browse files
committed
[GR-20446] Skip failing ObjectSpace.dump/.dump_all specs on Ruby 2.7
PullRequest: truffleruby/3705
2 parents f319111 + 4c079d5 commit 5e81941

File tree

2 files changed

+38
-32
lines changed

2 files changed

+38
-32
lines changed

spec/ruby/library/objectspace/dump_all_spec.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@
5555
stdout.should == "File\ntrue\n"
5656
end
5757

58-
it "dumps Ruby heap to a temporary file when passed output: :nil" do
59-
stdout = ruby_exe(<<~RUBY, options: "-robjspace")
58+
ruby_version_is "3.0" do
59+
it "dumps Ruby heap to a temporary file when passed output: :nil" do
60+
stdout = ruby_exe(<<~RUBY, options: "-robjspace")
6061
string = "abc"
6162
file = ObjectSpace.dump_all(output: nil)
6263
@@ -71,9 +72,10 @@
7172
file.close
7273
File.unlink file.path
7374
end
74-
RUBY
75+
RUBY
7576

76-
stdout.should == "File\ntrue\n"
77+
stdout.should == "File\ntrue\n"
78+
end
7779
end
7880

7981
it "dumps Ruby heap to stdout when passed output: :stdout" do

spec/ruby/library/objectspace/dump_spec.rb

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,45 +23,49 @@
2323
string.should include('"value":"abc"')
2424
end
2525

26-
it "dumps to a temporary file when passed output: :file" do
27-
file = ObjectSpace.dump("abc", output: :file)
28-
file.should be_kind_of(File)
26+
ruby_version_is "3.0" do
27+
it "dumps to a temporary file when passed output: :file" do
28+
file = ObjectSpace.dump("abc", output: :file)
29+
file.should be_kind_of(File)
2930

30-
file.rewind
31-
content = file.read
32-
content.should include('"value":"abc"')
33-
ensure
34-
file.close
35-
File.unlink file.path
36-
end
31+
file.rewind
32+
content = file.read
33+
content.should include('"value":"abc"')
34+
ensure
35+
file.close
36+
File.unlink file.path
37+
end
3738

38-
it "dumps to a temporary file when passed output: :nil" do
39-
file = ObjectSpace.dump("abc", output: nil)
40-
file.should be_kind_of(File)
39+
it "dumps to a temporary file when passed output: :nil" do
40+
file = ObjectSpace.dump("abc", output: nil)
41+
file.should be_kind_of(File)
4142

42-
file.rewind
43-
file.read.should include('"value":"abc"')
44-
ensure
45-
file.close
46-
File.unlink file.path
43+
file.rewind
44+
file.read.should include('"value":"abc"')
45+
ensure
46+
file.close
47+
File.unlink file.path
48+
end
4749
end
4850

4951
it "dumps to stdout when passed output: :stdout" do
5052
stdout = ruby_exe('ObjectSpace.dump("abc", output: :stdout)', options: "-robjspace").chomp
5153
stdout.should include('"value":"abc"')
5254
end
5355

54-
it "dumps to provided IO when passed output: IO" do
55-
filename = tmp("io_read.txt")
56-
io = File.open(filename, "w+")
57-
result = ObjectSpace.dump("abc", output: io)
58-
result.should.equal? io
56+
ruby_version_is "3.0" do
57+
it "dumps to provided IO when passed output: IO" do
58+
filename = tmp("io_read.txt")
59+
io = File.open(filename, "w+")
60+
result = ObjectSpace.dump("abc", output: io)
61+
result.should.equal? io
5962

60-
io.rewind
61-
io.read.should include('"value":"abc"')
62-
ensure
63-
io.close
64-
rm_r filename
63+
io.rewind
64+
io.read.should include('"value":"abc"')
65+
ensure
66+
io.close
67+
rm_r filename
68+
end
6569
end
6670

6771
it "raises ArgumentError when passed not supported :output value" do

0 commit comments

Comments
 (0)