Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: opal/opal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ee008768bfd9
Choose a base ref
...
head repository: opal/opal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 36bf584bcbb0
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Mar 12, 2015

  1. Copy the full SHA
    3446a22 View commit details
  2. Merge pull request #747 from vais/integer

    Integer#downto and Integer#upto fully compliant with rubyspec
    elia committed Mar 12, 2015

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    36bf584 View commit details
Showing with 6 additions and 2 deletions.
  1. +6 −0 opal/corelib/numeric.rb
  2. +0 −2 spec/filters/bugs/numeric.rb
6 changes: 6 additions & 0 deletions opal/corelib/numeric.rb
Original file line number Diff line number Diff line change
@@ -271,6 +271,9 @@ def downto(finish, &block)
return enum_for :downto, finish unless block

%x{
if (!finish.$$is_number) {
#{raise ArgumentError, "comparison of #{self.class} with #{finish.class} failed"}
}
for (var i = self; i >= finish; i--) {
if (block(i) === $breaker) {
return $breaker.$v;
@@ -460,6 +463,9 @@ def upto(finish, &block)
return enum_for :upto, finish unless block

%x{
if (!finish.$$is_number) {
#{raise ArgumentError, "comparison of #{self.class} with #{finish.class} failed"}
}
for (var i = self; i <= finish; i++) {
if (block(i) === $breaker) {
return $breaker.$v;
2 changes: 0 additions & 2 deletions spec/filters/bugs/numeric.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
opal_filter "Fixnum bugs" do
fails "Integer#downto [stop] when self and stop are Fixnums raises an ArgumentError for invalid endpoints"
fails "Integer#upto [stop] when self and stop are Fixnums raises an ArgumentError for non-numeric endpoints"
fails "Integer#even? returns true when self is an even number"

fails "Fixnum#to_s when no base given returns self converted to a String using base 10"