Skip to content

Commit

Permalink
The #fails_on guard has been removed. Use #ruby_bug or tagged excludes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Ford committed Feb 19, 2008
1 parent e24231f commit 6ba4901
Show file tree
Hide file tree
Showing 23 changed files with 142 additions and 169 deletions.
6 changes: 2 additions & 4 deletions spec/ruby/1.8/core/io/gets_spec.rb
Expand Up @@ -160,9 +160,7 @@
lambda { File.open(IOSpecs.gets_output, 'w') {|f| f.gets} }.should raise_error(IOError)
end

fails_on :rubinius do
it "raises IOError on closed stream" do
lambda { IOSpecs.closed_file.gets }.should raise_error(IOError)
end
it "raises IOError on closed stream" do
lambda { IOSpecs.closed_file.gets }.should raise_error(IOError)
end
end
18 changes: 8 additions & 10 deletions spec/ruby/1.8/core/io/print_spec.rb
Expand Up @@ -16,16 +16,14 @@ def to_s; @message; end
$\ = @old_separator
end

fails_on :jruby do
it "writes $_.to_s followed by $\\ (if any) to the stream if no arguments given" do
o = IOSpecPrint.new
o.message = 'I know what you did last line!'
$_ = o
l = lambda { $stdout.print }.should output_to_fd("#{o.message}#{$\}", STDOUT)

string = File.open(__FILE__) {|f| f.gets } # Set $_ to something known
lambda { $stdout.print }.should output_to_fd("#{string}#{$\}", STDOUT)
end
it "writes $_.to_s followed by $\\ (if any) to the stream if no arguments given" do
o = IOSpecPrint.new
o.message = 'I know what you did last line!'
$_ = o
l = lambda { $stdout.print }.should output_to_fd("#{o.message}#{$\}", STDOUT)

string = File.open(__FILE__) {|f| f.gets } # Set $_ to something known
lambda { $stdout.print }.should output_to_fd("#{string}#{$\}", STDOUT)
end

it "writes obj.to_s followed by $\\ (if any) to the stream when given one object" do
Expand Down
10 changes: 4 additions & 6 deletions spec/ruby/1.8/core/io/printf_spec.rb
Expand Up @@ -6,12 +6,10 @@
@io = IO.new STDOUT.fileno, 'w'
end

fails_on :jruby do
it "writes the #sprintf formatted string to the file descriptor" do
lambda {
@io.printf "%s\n", "look ma, no hands"
}.should output_to_fd("look ma, no hands\n", @io)
end
it "writes the #sprintf formatted string to the file descriptor" do
lambda {
@io.printf "%s\n", "look ma, no hands"
}.should output_to_fd("look ma, no hands\n", @io)
end

it "raises IOError on closed stream" do
Expand Down
6 changes: 2 additions & 4 deletions spec/ruby/1.8/core/io/puts_spec.rb
Expand Up @@ -15,10 +15,8 @@
@io.puts.should == nil
end

fails_on :jruby do
it "writes just a newline when given just a newline" do
lambda { $stdout.puts "\n" }.should output_to_fd("\n", STDOUT)
end
it "writes just a newline when given just a newline" do
lambda { $stdout.puts "\n" }.should output_to_fd("\n", STDOUT)
end

it "writes nil with a newline when given nil as an arg" do
Expand Down
7 changes: 2 additions & 5 deletions spec/ruby/1.8/core/io/read_spec.rb
Expand Up @@ -175,11 +175,8 @@
@io.read(1).should == nil
end

fails_on :rubinius do
it "raises IOError on closed stream" do
lambda { IOSpecs.closed_file.read }.should raise_error(IOError)
end
it "raises IOError on closed stream" do
lambda { IOSpecs.closed_file.read }.should raise_error(IOError)
end

end

6 changes: 2 additions & 4 deletions spec/ruby/1.8/core/io/readline_spec.rb
Expand Up @@ -10,9 +10,7 @@
end
end

fails_on :rubinius do
it "raises IOError on closed stream" do
lambda { IOSpecs.closed_file.readline }.should raise_error(IOError)
end
it "raises IOError on closed stream" do
lambda { IOSpecs.closed_file.readline }.should raise_error(IOError)
end
end
6 changes: 2 additions & 4 deletions spec/ruby/1.8/core/io/readlines_spec.rb
Expand Up @@ -16,10 +16,8 @@
end
end

fails_on :rubinius do
it "raises IOError on closed stream" do
lambda { IOSpecs.closed_file.readlines }.should raise_error(IOError)
end
it "raises IOError on closed stream" do
lambda { IOSpecs.closed_file.readlines }.should raise_error(IOError)
end
end

Expand Down
6 changes: 2 additions & 4 deletions spec/ruby/1.8/core/io/readpartial_spec.rb
Expand Up @@ -2,9 +2,7 @@
require File.dirname(__FILE__) + '/fixtures/classes'

describe "IO#readpartial" do
fails_on :rubinius do
it "raises IOError on closed stream" do
lambda { IOSpecs.closed_file.readpartial(10) }.should raise_error(IOError)
end
it "raises IOError on closed stream" do
lambda { IOSpecs.closed_file.readpartial(10) }.should raise_error(IOError)
end
end
28 changes: 13 additions & 15 deletions spec/ruby/1.8/core/io/reopen_spec.rb
Expand Up @@ -56,25 +56,23 @@
File.readlines(@name2_w).should == ["line1-F2\n"]
end

fails_on :jruby do
# JRUBY-2071: File#reopen blows with IllegalArgumentException in some cases
it "reassociates self with the I/O stream specified as an argument, after some reads" do
length = 12 # length of first lines in numbered_lines.txt
# JRUBY-2071: File#reopen blows with IllegalArgumentException in some cases
it "reassociates self with the I/O stream specified as an argument, after some reads" do
length = 12 # length of first lines in numbered_lines.txt

# reade some first
@file1.gets
@file2.gets
# reade some first
@file1.gets
@file2.gets

pos = @file2.pos
@file1.reopen(@file2)
@file1.pos.should == pos
pos = @file2.pos
@file1.reopen(@file2)
@file1.pos.should == pos

# MRI behavior: after reopen the buffers are not corrected,
# so we need the following line, or next gets wourd return nil.
@file1.pos = pos
# MRI behavior: after reopen the buffers are not corrected,
# so we need the following line, or next gets wourd return nil.
@file1.pos = pos

@file1.gets.should == "Line 2: Two\n"
end
@file1.gets.should == "Line 2: Two\n"
end

it "reassociates self with the I/O stream specified as an argument, after some sysreads" do
Expand Down
6 changes: 2 additions & 4 deletions spec/ruby/1.8/core/io/shared/each.rb
Expand Up @@ -40,10 +40,8 @@
end
end

fails_on :rubinius do
it "raises IOError on closed stream" do
lambda { IOSpecs.closed_file.send(cmd) }.should raise_error(IOError)
end
it "raises IOError on closed stream" do
lambda { IOSpecs.closed_file.send(cmd) }.should raise_error(IOError)
end
end
end
6 changes: 2 additions & 4 deletions spec/ruby/1.8/core/io/sysread_spec.rb
Expand Up @@ -75,9 +75,7 @@
end
end

fails_on :rubinius do
it "raises IOError on closed stream" do
lambda { IOSpecs.closed_file.sysread(5) }.should raise_error(IOError)
end
it "raises IOError on closed stream" do
lambda { IOSpecs.closed_file.sysread(5) }.should raise_error(IOError)
end
end
18 changes: 8 additions & 10 deletions spec/ruby/1.8/core/module/new_spec.rb
Expand Up @@ -6,16 +6,14 @@
Module.new.is_a?(Module).should == true
end

fails_on :rbx do
it "evaluates a passed block in the context of the module" do
fred = Module.new do
def hello() "hello" end
def bye() "bye" end
end

(o = mock('x')).extend(fred)
o.hello.should == "hello"
o.bye.should == "bye"
it "evaluates a passed block in the context of the module" do
fred = Module.new do
def hello() "hello" end
def bye() "bye" end
end

(o = mock('x')).extend(fred)
o.hello.should == "hello"
o.bye.should == "bye"
end
end
35 changes: 18 additions & 17 deletions spec/ruby/1.8/core/numeric/divmod_spec.rb
Expand Up @@ -5,40 +5,41 @@
# q = floor(float(x)/float(y))
# x = q*y + r

# FIXME: this awful wording
describe "Numeric#divmod" do
it "divmod right integers" do
13.divmod(4).should == [3,1]
4.divmod(13).should == [0,4]
it "returns self divmod other" do
(3**33).divmod(100).should == [55590605665555, 23]
end

it "divmod right integers and floats" do
13.divmod(4.0).should == [3,1]
it "returns an Integer [quotient, modulus] when operating with Integers" do
13.divmod(4).should == [3,1]
4.divmod(13).should == [0,4]
end

it "divmod right the integers and floats" do
it "returns [quotent, modulus] where modulus may be Float or Integer when operating with Integers and Floats" do
13.divmod(4.0).should == [3,1]
4.divmod(13).should == [0,4]
4.divmod(13.0).should == [0,4]
a, b = 13.divmod(4.6)
a.should == 2
b.should be_close(3.8, TOLERANCE)
end

it "divmod right floats" do
it "returns a Float [quotient, modulus] when operating with Floats" do
13.0.divmod(4.0).should == [3.0,1.0]
4.0.divmod(13).should == [0.0,4.0]
# MRI 1.8.6 bug Numeric#divmod bug
# http://rubyforge.org/tracker/?func=detail&atid=1698&aid=14540&group_id=426
y = 1 / 12.0
0.58.divmod(y).first.should == 6
fails_on(:ruby) do
0.67.divmod(y).first.should == 8
end

ruby_bug do
# MRI 1.8.6 bug Numeric#divmod bug
# http://rubyforge.org/tracker/?func=detail&atid=1698&aid=14540&group_id=426
it "returns a Float [quotient, modulus] when operating with Floats" do
y = 1 / 12.0
0.59.divmod(y).first.should == 7
0.63.divmod(y).first.should == 7
0.66.divmod(y).first.should == 7
end
0.67.divmod(y).first.should == 8
end

it "returns self divmod other" do
(3**33).divmod( 100).should == [55590605665555, 23]
end

it "raises an ArgumentError when not passed one argument" do
Expand Down
2 changes: 1 addition & 1 deletion spec/ruby/1.8/core/numeric/quo_spec.rb
Expand Up @@ -35,7 +35,7 @@
4.0.quo(13).should be_close(0.307692307692308, TOLERANCE)
end

fails_on :ruby do
ruby_bug do
# NOTE: Doesn't work when run with RSpec because it loads rational.rb
it " should quo right with bignums and integers" do
2147483648.quo(100).to_s.should == 21474836.48.to_s
Expand Down
9 changes: 6 additions & 3 deletions spec/ruby/1.8/core/time/shared/time_params.rb
Expand Up @@ -5,9 +5,12 @@
Time.send(cmd, 2008, "dec").should == Time.send(cmd, 2008, 12)
(obj = mock('12')).should_receive(:to_str).and_return("12")
Time.send(cmd, 2008, obj).should == Time.send(cmd, 2008, 12)
fails_on(:ruby) do
# Exclude MRI 1.8.6 because it segfaults. :)
# But the problem is fixed in MRI repository already.
end

ruby_bug do
# Exclude MRI 1.8.6 because it segfaults. :)
# But the problem is fixed in MRI repository already.
it "handles string-like second argument" do
(obj = mock('dec')).should_receive(:to_str).and_return('dec')
Time.send(cmd, 2008, obj).should == Time.send(cmd, 2008, 12)
end
Expand Down
8 changes: 4 additions & 4 deletions spec/ruby/1.8/library/date/constants_spec.rb
Expand Up @@ -11,14 +11,14 @@
Date::ENGLAND.should == 2361222 # 1752-09-14
end

it "should define JULIAN" do
fails_on(:ruby) do
ruby_bug do
it "should define JULIAN" do
(Date::JULIAN <=> Date::Infinity.new).should == 0
end
end

it "should define GREGORIAN" do
fails_on(:ruby) do
ruby_bug do
it "should define GREGORIAN" do
(Date::GREGORIAN <=> -Date::Infinity.new).should == 0
end
end
Expand Down
28 changes: 14 additions & 14 deletions spec/ruby/1.8/library/date/infinity_spec.rb
Expand Up @@ -36,12 +36,12 @@
end

# These checks fail on MRI because of a bug in Date::Infinity#<=>
it "should be able to compare Infinity objects" do
i1 = Date::Infinity.new
i2 = Date::Infinity.new(-1)
i3 = Date::Infinity.new(0)
i4 = Date::Infinity.new
fails_on :ruby do
ruby_bug do
it "should be able to compare Infinity objects" do
i1 = Date::Infinity.new
i2 = Date::Infinity.new(-1)
i3 = Date::Infinity.new(0)
i4 = Date::Infinity.new
(i4 <=> i1).should == 0
(i3 <=> i1).should == -1
(i2 <=> i1).should == -1
Expand All @@ -50,18 +50,18 @@
end

# Also fails because of the same bug as the previous spec
it "should be able to return plus Infinity for abs" do
i1 = Date::Infinity.new
i2 = Date::Infinity.new(-1)
i3 = Date::Infinity.new(0)
fails_on :ruby do
ruby_bug do
it "should be able to return plus Infinity for abs" do
i1 = Date::Infinity.new
i2 = Date::Infinity.new(-1)
i3 = Date::Infinity.new(0)
(i2.abs <=> i1).should == 0
(i3.abs <=> i1).should == 0
end
end

it "should be able to use -@ and +@ for Date::Infinity" do
fails_on :ruby do
ruby_bug do
it "should be able to use -@ and +@ for Date::Infinity" do
(Date::Infinity.new <=> +Date::Infinity.new).should == 0
(Date::Infinity.new(-1) <=> -Date::Infinity.new).should == 0
end
Expand All @@ -72,4 +72,4 @@
Date::Infinity.new(0).coerce(2).should == [0, 0]
Date::Infinity.new(-1).coerce(1.5).should == [1, -1]
end
end
end

0 comments on commit 6ba4901

Please sign in to comment.