Skip to content

Commit 76de440

Browse files
committed
Skip more warnings
1 parent 171da41 commit 76de440

2 files changed

Lines changed: 12 additions & 30 deletions

File tree

lib/elixir/test/elixir/calendar/datetime_test.exs

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ defmodule DateTimeTest do
764764
end
765765

766766
describe "diff" do
767-
test "diff with invalid time unit" do
767+
test "with invalid time unit" do
768768
dt = DateTime.utc_now()
769769

770770
message =
@@ -773,7 +773,7 @@ defmodule DateTimeTest do
773773
assert_raise ArgumentError, message, fn -> DateTime.diff(dt, dt, "day") end
774774
end
775775

776-
test "diff with valid time unit" do
776+
test "with valid time unit" do
777777
dt1 = %DateTime{
778778
year: 100,
779779
month: 2,
@@ -808,7 +808,7 @@ defmodule DateTimeTest do
808808
assert DateTime.diff(Map.from_struct(dt1), Map.from_struct(dt2)) == 3_281_904_000
809809
end
810810

811-
test "diff with microseconds" do
811+
test "with microseconds" do
812812
datetime = ~U[2023-02-01 10:30:10.123456Z]
813813

814814
in_almost_7_days =
@@ -819,7 +819,7 @@ defmodule DateTimeTest do
819819
assert DateTime.diff(in_almost_7_days, datetime, :day) == 6
820820
end
821821

822-
test "diff in microseconds" do
822+
test "in microseconds" do
823823
datetime1 = ~U[2023-02-01 10:30:10.000000Z]
824824
datetime2 = DateTime.add(datetime1, 1234, :microsecond)
825825

@@ -1003,16 +1003,7 @@ defmodule DateTimeTest do
10031003
end
10041004

10051005
describe "add" do
1006-
test "add with invalid time unit" do
1007-
dt = DateTime.utc_now()
1008-
1009-
message =
1010-
~r/unsupported time unit\. Expected :day, :hour, :minute, :second, :millisecond, :microsecond, :nanosecond, or a positive integer, got "day"/
1011-
1012-
assert_raise ArgumentError, message, fn -> DateTime.add(dt, 1, "day") end
1013-
end
1014-
1015-
test "add with non-struct map that conforms to Calendar.datetime" do
1006+
test "with non-struct map that conforms to Calendar.datetime" do
10161007
dt_map = DateTime.from_naive!(~N[2018-08-28 00:00:00], "Etc/UTC") |> Map.from_struct()
10171008

10181009
assert DateTime.add(dt_map, 1, :second) == %DateTime{
@@ -1031,7 +1022,7 @@ defmodule DateTimeTest do
10311022
}
10321023
end
10331024

1034-
test "error with UTC only database and non UTC datetime" do
1025+
test "with UTC only database and non UTC datetime emits error" do
10351026
dt =
10361027
DateTime.from_naive!(~N[2018-08-28 00:00:00], "Europe/Copenhagen", FakeTimeZoneDatabase)
10371028

@@ -1040,7 +1031,7 @@ defmodule DateTimeTest do
10401031
end
10411032
end
10421033

1043-
test "add/2 with other calendars" do
1034+
test "with other calendars" do
10441035
assert ~N[2000-01-01 12:34:15.123456]
10451036
|> NaiveDateTime.convert!(Calendar.Holocene)
10461037
|> DateTime.from_naive!("Etc/UTC")

lib/elixir/test/elixir/calendar/naive_datetime_test.exs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -152,16 +152,7 @@ defmodule NaiveDateTimeTest do
152152
end
153153

154154
describe "add" do
155-
test "add with invalid time unit" do
156-
dt = NaiveDateTime.utc_now()
157-
158-
message =
159-
~r/unsupported time unit\. Expected :day, :hour, :minute, :second, :millisecond, :microsecond, :nanosecond, or a positive integer, got "day"/
160-
161-
assert_raise ArgumentError, message, fn -> NaiveDateTime.add(dt, 1, "day") end
162-
end
163-
164-
test "add with other calendars" do
155+
test "with other calendars" do
165156
assert ~N[2000-01-01 12:34:15.123456]
166157
|> NaiveDateTime.convert!(Calendar.Holocene)
167158
|> NaiveDateTime.add(10, :second) ==
@@ -177,7 +168,7 @@ defmodule NaiveDateTimeTest do
177168
}
178169
end
179170

180-
test "add with datetime" do
171+
test "with datetime" do
181172
dt = %DateTime{
182173
year: 2000,
183174
month: 2,
@@ -197,7 +188,7 @@ defmodule NaiveDateTimeTest do
197188
end
198189

199190
describe "diff" do
200-
test "diff with invalid time unit" do
191+
test "with invalid time unit" do
201192
dt = NaiveDateTime.utc_now()
202193

203194
message =
@@ -206,14 +197,14 @@ defmodule NaiveDateTimeTest do
206197
assert_raise ArgumentError, message, fn -> NaiveDateTime.diff(dt, dt, "day") end
207198
end
208199

209-
test "diff with other calendars" do
200+
test "with other calendars" do
210201
assert ~N[2000-01-01 12:34:15.123456]
211202
|> NaiveDateTime.convert!(Calendar.Holocene)
212203
|> NaiveDateTime.add(10, :second)
213204
|> NaiveDateTime.diff(~N[2000-01-01 12:34:15.123456]) == 10
214205
end
215206

216-
test "diff with datetime" do
207+
test "with datetime" do
217208
dt = %DateTime{
218209
year: 2000,
219210
month: 2,

0 commit comments

Comments
 (0)