Skip to content

Commit 71ea2c0

Browse files
committed
Add test for Date.compare/2 with incompatible calendars
1 parent 799b4ff commit 71ea2c0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/elixir/test/elixir/calendar/date_test.exs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ defmodule DateTest do
9191
assert Date.compare(date4, date5) == :gt
9292
assert Date.compare(date5, date4) == :lt
9393
assert Date.compare(date5, date5) == :eq
94+
95+
assert_raise ArgumentError,
96+
~r/cannot compare .*\n\n.* their calendars have incompatible day rollover moments/,
97+
fn -> Date.compare(date1, %{date2 | calendar: FakeCalendar}) end
9498
end
9599

96100
test "before?/2 and after?/2" do

0 commit comments

Comments
 (0)