Skip to content

Commit 56e8c92

Browse files
authored
Fix #11 (#12)
* Add failing test * Fix #11
1 parent f894bbe commit 56e8c92

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/operators.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ for op in (:+, :-, :&, :|, :xor, :(==))
1010
N = promote_type(T, S)
1111
($op)(N(a), N(b))
1212
end
13-
($op)(a::S, b::Cenum{T}) where {T<:Integer,S<:Integer} = ($op)(b, a)
13+
function ($op)(a::T, b::Cenum{S}) where {T<:Integer,S<:Integer}
14+
N = promote_type(T, S)
15+
($op)(N(a), N(b))
16+
end
1417
end
1518
end
1619

test/runtests.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,6 @@ using Test
2424
@test Wed == 3 == suiyoubi
2525
@test Fri == 5
2626
@test Sat == 6
27+
28+
# issue #11
29+
@test 0 - one == -1

0 commit comments

Comments
 (0)