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: da88c216be4e
Choose a base ref
...
head repository: opal/opal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 911abe69c29c
Choose a head ref
  • 4 commits
  • 5 files changed
  • 1 contributor

Commits on Oct 29, 2013

  1. Copy the full SHA
    a2e9c13 View commit details
  2. Copy the full SHA
    7a1fb18 View commit details
  3. Copy the full SHA
    1494f56 View commit details
  4. Copy the full SHA
    911abe6 View commit details
Showing with 19 additions and 7 deletions.
  1. +1 −1 corelib/hash.rb
  2. +0 −6 spec/filters/bugs/hash.rb
  3. +1 −0 spec/filters/unsupported/frozen.rb
  4. +16 −0 spec/filters/unsupported/hash_compare_by_identity.rb
  5. +1 −0 spec/rubyspecs
2 changes: 1 addition & 1 deletion corelib/hash.rb
Original file line number Diff line number Diff line change
@@ -400,7 +400,7 @@ def index(object)
for (var i = 0, length = keys.length; i < length; i++) {
var key = keys[i];
if (#{object == `map[key]`}) {
if (#{`map[key]` == object}) {
return key;
}
}
6 changes: 0 additions & 6 deletions spec/filters/bugs/hash.rb
Original file line number Diff line number Diff line change
@@ -62,7 +62,6 @@
fails "Hash#[] compares keys with the same #hash value via #eql?"
fails "Hash#[] finds a value via an identical key even when its #eql? isn't reflexive"

fails "Hash#[]= duplicates and freezes string keys"
fails "Hash#[]= stores unequal keys that hash to the same value"
fails "Hash#[]= associates the key with the value and return the value"

@@ -82,23 +81,18 @@
fails "Hash#include? compares keys with the same #hash value via #eql?"
fails "Hash#include? returns true if argument is a key"

fails "Hash#index compares values using =="

fails "Hash#invert compares new keys with eql? semantics"

fails "Hash#initialize_copy does not transfer default values"
fails "Hash#initialize_copy calls to_hash on hash subclasses"
fails "Hash#initialize_copy tries to convert the passed argument to a hash using #to_hash"
fails "Hash#initialize_copy tries to convert the passed argument to a hash using #to_hash"
fails "Hash#initialize_copy replaces the contents of self with other"

fails "Hash#inspect handles hashes with recursive values"

fails "Hash#key? compares keys with the same #hash value via #eql?"
fails "Hash#key? returns true if argument is a key"

fails "Hash#key compares values using =="

fails "Hash#member? compares keys with the same #hash value via #eql?"
fails "Hash#member? returns true if argument is a key"

1 change: 1 addition & 0 deletions spec/filters/unsupported/frozen.rb
Original file line number Diff line number Diff line change
@@ -84,4 +84,5 @@
fails "Hash#update checks frozen status before coercing an object with #to_hash"
fails "Hash#update raises a RuntimeError on a frozen instance that is modified"
fails "Hash#rehash raises a RuntimeError if called on a frozen instance"
fails "Hash#[]= duplicates and freezes string keys"
end
16 changes: 16 additions & 0 deletions spec/filters/unsupported/hash_compare_by_identity.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
opal_filter "Hash#comapre_by_identity" do
fails "Hash#compare_by_identity causes future comparisons on the receiver to be made by identity"
fails "Hash#compare_by_identity causes #compare_by_identity? to return true"
fails "Hash#compare_by_identity returns self"
fails "Hash#compare_by_identity uses the semantics of BasicObject#equal? to determine key identity"
fails "Hash#compare_by_identity uses #equal? semantics, but doesn't actually call #equal? to determine identity"
fails "Hash#compare_by_identity regards #dup'd objects as having different identities"
fails "Hash#compare_by_identity regards #clone'd objects as having different identities"
fails "Hash#compare_by_identity regards references to the same object as having the same identity"
fails "Hash#compare_by_identity raises a RuntimeError on frozen hashes"
fails "Hash#compare_by_identity perists over #dups"
fails "Hash#compare_by_identity persists over #clones"
fails "Hash#compare_by_identity? returns false by default"
fails "Hash#compare_by_identity? returns true once #compare_by_identity has been invoked on self"
fails "Hash#compare_by_identity? returns true when called multiple times on the same ident hash"
end
1 change: 1 addition & 0 deletions spec/rubyspecs
Original file line number Diff line number Diff line change
@@ -150,6 +150,7 @@ core/enumerator/rewind_spec

core/hash/allocate_spec
core/hash/assoc_spec
core/hash/compare_by_identity_spec
core/hash/clear_spec
core/hash/clone_spec
core/hash/constructor_spec