Skip to content

Commit 2a0fb0c

Browse files
committed
Add tests for Time.to_iso8601/2
1 parent 050f9e2 commit 2a0fb0c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,18 @@ defmodule TimeTest do
3838
end
3939
end
4040

41+
test "to_iso8601/2" do
42+
time1 = ~T[23:00:07.005]
43+
assert Time.to_iso8601(time1) == "23:00:07.005"
44+
assert Time.to_iso8601(Map.from_struct(time1)) == "23:00:07.005"
45+
assert Time.to_iso8601(time1, :basic) == "230007.005"
46+
47+
time2 = ~T[23:00:07.005 Calendar.Holocene]
48+
assert Time.to_iso8601(time2) == "23:00:07.005"
49+
assert Time.to_iso8601(Map.from_struct(time2)) == "23:00:07.005"
50+
assert Time.to_iso8601(time2, :basic) == "230007.005"
51+
end
52+
4153
test "to_string/1" do
4254
time = ~T[23:00:07.005]
4355
assert to_string(time) == "23:00:07.005"

0 commit comments

Comments
 (0)