Skip to content

Commit 7affa29

Browse files
add test
1 parent 4c01913 commit 7affa29

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,13 @@ defmodule DateTest do
249249
"cannot shift date by time scale unit. Expected :year, :month, :week, :day",
250250
fn -> Date.shift(~D[2012-02-29], %Duration{second: 86400}) end
251251

252+
# Microsecond precision is ignored
253+
assert Date.shift(~D[2012-02-29], Duration.new!(microsecond: {0, 6})) == ~D[2012-02-29]
254+
255+
assert_raise ArgumentError,
256+
"cannot shift date by time scale unit. Expected :year, :month, :week, :day",
257+
fn -> Date.shift(~D[2012-02-29], %Duration{microsecond: {100, 6}}) end
258+
252259
# Implements calendar callback
253260
assert_raise RuntimeError, "shift_date/4 not implemented", fn ->
254261
date = Calendar.Holocene.date(10000, 01, 01)

0 commit comments

Comments
 (0)