Skip to content

Commit 5f9afce

Browse files
committed
refactor(test): remove use of deprecated values
Remove tests that exercised deprecated no-op functions (to_gleam_duration, from_gleam_duration, get_milli_second) and replace duration conversion test with one that uses Duration as gleam_time's Duration type directly.
1 parent 3dfed06 commit 5f9afce

File tree

1 file changed

+3
-28
lines changed

1 file changed

+3
-28
lines changed

test/birl_test.gleam

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -298,21 +298,10 @@ pub fn timestamp_epoch_test() {
298298
|> should.equal(0)
299299
}
300300

301-
pub fn duration_roundtrip_test() {
302-
let d = duration.hours(2) |> duration.add(duration.minutes(30))
303-
let gleam_d = duration.to_gleam_duration(d)
304-
let back = duration.from_gleam_duration(gleam_d)
305-
d
306-
|> should.equal(back)
307-
}
308-
309-
pub fn duration_conversion_test() {
310-
// 1 second = 1_000_000 microseconds in birl
311-
// 1 second = 1_000_000_000 nanoseconds in gleam_time
301+
pub fn duration_is_gleam_time_duration_test() {
302+
// Duration is gleam_time's Duration type, so it works directly
312303
let d = duration.seconds(1)
313-
let gleam_d = duration.to_gleam_duration(d)
314-
let #(seconds, nanoseconds) =
315-
time_duration.to_seconds_and_nanoseconds(gleam_d)
304+
let #(seconds, nanoseconds) = time_duration.to_seconds_and_nanoseconds(d)
316305
seconds
317306
|> should.equal(1)
318307
nanoseconds
@@ -346,20 +335,6 @@ pub fn time_of_day_roundtrip_test() {
346335
|> should.equal(back)
347336
}
348337

349-
pub fn get_milli_second_test() {
350-
let tod = birl.TimeOfDay(14, 30, 45, 123_000_000)
351-
birl.get_milli_second(tod)
352-
|> should.equal(123)
353-
354-
let tod_zero = birl.TimeOfDay(0, 0, 0, 0)
355-
birl.get_milli_second(tod_zero)
356-
|> should.equal(0)
357-
358-
let tod_sub_ms = birl.TimeOfDay(0, 0, 0, 500_000)
359-
birl.get_milli_second(tod_sub_ms)
360-
|> should.equal(0)
361-
}
362-
363338
pub fn to_unix_nano_test() {
364339
birl.unix_epoch()
365340
|> birl.to_unix_nano

0 commit comments

Comments
 (0)