Skip to content

Commit

Permalink
fix compare enums, fixed #3845
Browse files Browse the repository at this point in the history
  • Loading branch information
kostya authored and Ary Borenszweig committed Jan 6, 2017
1 parent 1441680 commit 1e7f46e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions spec/std/enum_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,8 @@ describe Enum do
values.should eq([SpecEnumFlags::One.value, SpecEnumFlags::Two.value, SpecEnumFlags::Three.value])
end
end

it "different enums classes not eq always" do
SpecEnum::One.should_not eq SpecEnum2::FourtyTwo
end
end
5 changes: 5 additions & 0 deletions src/enum.cr
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,11 @@ struct Enum
value <=> other.value
end

# :nodoc:
def ==(other)
false
end

# Returns `true` if this enum member's value includes *other*. This
# performs a logical "and" between this enum member's value and *other*'s,
# so instead of writing:
Expand Down

0 comments on commit 1e7f46e

Please sign in to comment.