Skip to content

Commit 97c5378

Browse files
committed
Test Time.shift/2 with invalid values
1 parent c9b74a0 commit 97c5378

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/elixir/test/elixir/calendar/time_test.exs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,5 +165,13 @@ defmodule TimeTest do
165165
assert_raise ArgumentError,
166166
"cannot shift time by date scale unit. Expected :hour, :minute, :second, :microsecond",
167167
fn -> Time.shift(time, %Duration{day: 1}) end
168+
169+
assert_raise ArgumentError,
170+
"unsupported value nil for :minute. Expected an integer",
171+
fn -> Time.shift(time, minute: nil) end
172+
173+
assert_raise ArgumentError,
174+
~r/unsupported value 1 for :microsecond. Expected a tuple \{ms, precision\}/,
175+
fn -> Time.shift(time, microsecond: 1) end
168176
end
169177
end

0 commit comments

Comments
 (0)