Skip to content

Commit c2e75b7

Browse files
committed
Add test for non-integer duration shift
1 parent b4205e2 commit c2e75b7

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
@@ -249,6 +249,10 @@ defmodule DateTest do
249249
"unknown unit :months. Expected :year, :month, :week, :day",
250250
fn -> Date.shift(~D[2012-01-01], months: 12) end
251251

252+
assert_raise ArgumentError,
253+
"unsupported value nil for :day. Expected an integer",
254+
fn -> Date.shift(~D[2012-02-29], year: 1, day: nil) end
255+
252256
assert_raise ArgumentError,
253257
"cannot shift date by time scale unit. Expected :year, :month, :week, :day",
254258
fn -> Date.shift(~D[2012-02-29], %Duration{second: 86400}) end

0 commit comments

Comments
 (0)