Skip to content

Commit 1ada0bc

Browse files
herwinwandrykonchin
authored andcommitted
Move non-linux specs for Rational exponents with ArgumentErrors
The check for ArgumentError is performed within Ruby itself, and unrelated to bugs in pow() in glibc. These specs should run on Linux too.
1 parent 8b46336 commit 1ada0bc

File tree

1 file changed

+18
-20
lines changed

1 file changed

+18
-20
lines changed

shared/rational/exponent.rb

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,24 @@
122122
(Rational(fixnum_max) ** -bignum_value)
123123
}.should raise_error(ArgumentError)
124124
end
125+
126+
it "raises an ArgumentError when self is < -1" do
127+
-> {
128+
(Rational(-2) ** bignum_value)
129+
}.should raise_error(ArgumentError)
130+
-> {
131+
(Rational(fixnum_min) ** bignum_value)
132+
}.should raise_error(ArgumentError)
133+
end
134+
135+
it "raises an ArgumentError when self is < -1 and the exponent is negative" do
136+
-> {
137+
(Rational(-2) ** -bignum_value)
138+
}.should raise_error(ArgumentError)
139+
-> {
140+
(Rational(fixnum_min) ** -bignum_value)
141+
}.should raise_error(ArgumentError)
142+
end
125143
end
126144

127145
# Fails on linux due to pow() bugs in glibc: http://sources.redhat.com/bugzilla/show_bug.cgi?id=3866
@@ -148,26 +166,6 @@
148166
}.should complain(/warning: in a\*\*b, b may be too big/)
149167
end
150168
end
151-
152-
ruby_version_is "3.4" do
153-
it "raises an ArgumentError when self < -1" do
154-
-> {
155-
(Rational(-2) ** bignum_value)
156-
}.should raise_error(ArgumentError)
157-
-> {
158-
(Rational(fixnum_min) ** bignum_value)
159-
}.should raise_error(ArgumentError)
160-
end
161-
162-
it "raises an ArgumentError when self is < -1 and the exponent is negative" do
163-
-> {
164-
(Rational(-2) ** -bignum_value)
165-
}.should raise_error(ArgumentError)
166-
-> {
167-
(Rational(fixnum_min) ** -bignum_value)
168-
}.should raise_error(ArgumentError)
169-
end
170-
end
171169
end
172170
end
173171

0 commit comments

Comments
 (0)