Skip to content

Commit

Permalink
Merge pull request #1053 from herwinw/range_include_cover
Browse files Browse the repository at this point in the history
Move mismatch of Range#cover? and Range#include? out of shared folder
  • Loading branch information
andrykonchin authored Aug 17, 2023
2 parents b8a59fd + ff1b7d7 commit 30be6b9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions core/range/cover_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@
it_behaves_like :range_cover_and_include, :cover?
it_behaves_like :range_cover, :cover?
it_behaves_like :range_cover_subrange, :cover?

it "covers U+9995 in the range U+0999..U+9999" do
("\u{999}".."\u{9999}").cover?("\u{9995}").should be_true
end
end
4 changes: 4 additions & 0 deletions core/range/include_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@
describe "Range#include?" do
it_behaves_like :range_cover_and_include, :include?
it_behaves_like :range_include, :include?

it "does not include U+9995 in the range U+0999..U+9999" do
("\u{999}".."\u{9999}").include?("\u{9995}").should be_false
end
end
1 change: 0 additions & 1 deletion core/range/shared/cover_and_include.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
it "returns true if argument is less than the last value of the range and greater than the first value" do
(20..30).send(@method, 28).should be_true
('e'..'h').send(@method, 'g').should be_true
("\u{999}".."\u{9999}").send @method, "\u{9995}"
end

it "returns true if argument is sole element in the range" do
Expand Down

0 comments on commit 30be6b9

Please sign in to comment.