From f8599bf8ef1b7ac9f88de9f4a2860c2e958f5d7a Mon Sep 17 00:00:00 2001 From: Compey Date: Wed, 23 Aug 2023 18:44:29 +0530 Subject: [PATCH] chore(tests): remove deprecated method usage --- tests/de.rs | 7 ++++++- tests/en.rs | 19 ++++++++++++++----- tests/es.rs | 7 ++++++- tests/fr.rs | 7 ++++++- tests/it.rs | 7 ++++++- tests/ja.rs | 7 ++++++- tests/pt-br.rs | 7 ++++++- tests/pt.rs | 7 ++++++- 8 files changed, 56 insertions(+), 12 deletions(-) diff --git a/tests/de.rs b/tests/de.rs index a6d977c..0d38c52 100644 --- a/tests/de.rs +++ b/tests/de.rs @@ -7,7 +7,12 @@ use chrono_locale::LocaleDate; // This test is copied from chrono's, disabling unsupported features #[test] fn format_it() { - let dt = FixedOffset::east(34200).ymd(2001, 7, 8).and_hms_nano(0, 34, 59, 1_026_490_708); + let dt = FixedOffset::east_opt(34200) + .expect("out of bound") + .with_ymd_and_hms(2001, 7, 8, 0, 34, 59) + .unwrap() + .with_nanosecond(1_026_490_708) + .expect("out of bound"); let locale = "de"; // date specifiers diff --git a/tests/en.rs b/tests/en.rs index 0c4aab9..3e43fb3 100644 --- a/tests/en.rs +++ b/tests/en.rs @@ -1,13 +1,18 @@ extern crate chrono; extern crate chrono_locale; -use chrono::{FixedOffset, TimeZone, Timelike, NaiveDateTime}; +use chrono::{FixedOffset, TimeZone, Timelike}; use chrono_locale::LocaleDate; // This test is copied from chrono's, disabling unsupported features #[test] fn format_en() { - let dt = FixedOffset::east(34200).ymd(2001, 7, 8).and_hms_nano(0, 34, 59, 1_026_490_708); + let dt = FixedOffset::east_opt(34200) + .expect("out of bound") + .with_ymd_and_hms(2001, 7, 8, 0, 34, 59) + .unwrap() + .with_nanosecond(1_026_490_708) + .expect("out of bound"); let locale = "en"; // date specifiers @@ -82,10 +87,14 @@ fn format_en() { assert_eq!(dt.formatl("%%", locale).to_string(), "%"); } - #[test] fn format_en_naive() { - let dt = FixedOffset::east(34200).ymd(2001, 7, 8).and_hms_nano(0, 34, 59, 1_026_490_708); + let dt = FixedOffset::east_opt(34200) + .expect("out of bound") + .with_ymd_and_hms(2001, 7, 8, 0, 34, 59) + .unwrap() + .with_nanosecond(1_026_490_708) + .expect("out of bound"); let dt = dt.naive_local(); let locale = "en"; @@ -133,7 +142,7 @@ fn format_en_naive() { // date & time specifiers assert_eq!(dt.formatl("%c", locale).to_string(), "Sun Jul 8 00:34:60 2001"); -// assert_eq!(dt.formatl("%+", locale).to_string(), "2001-07-08T00:34:60.026490708+09:30"); + // assert_eq!(dt.formatl("%+", locale).to_string(), "2001-07-08T00:34:60.026490708+09:30"); assert_eq!(dt.formatl("%s", locale).to_string(), "994552499"); // special specifiers diff --git a/tests/es.rs b/tests/es.rs index 5d38259..09b84e8 100644 --- a/tests/es.rs +++ b/tests/es.rs @@ -7,7 +7,12 @@ use chrono_locale::LocaleDate; // This test is copied from chrono's, disabling unsupported features #[test] fn format_it() { - let dt = FixedOffset::east(34200).ymd(2001, 7, 8).and_hms_nano(0, 34, 59, 1_026_490_708); + let dt = FixedOffset::east_opt(34200) + .expect("out of bound") + .with_ymd_and_hms(2001, 7, 8, 0, 34, 59) + .unwrap() + .with_nanosecond(1_026_490_708) + .expect("out of bound"); let locale = "es"; // date specifiers diff --git a/tests/fr.rs b/tests/fr.rs index 71206c8..e0c704e 100644 --- a/tests/fr.rs +++ b/tests/fr.rs @@ -7,7 +7,12 @@ use chrono_locale::LocaleDate; // This test is copied from chrono's, disabling unsupported features #[test] fn format_it() { - let dt = FixedOffset::east(34200).ymd(2001, 7, 8).and_hms_nano(0, 34, 59, 1_026_490_708); + let dt = FixedOffset::east_opt(34200) + .expect("out of bound") + .with_ymd_and_hms(2001, 7, 8, 0, 34, 59) + .unwrap() + .with_nanosecond(1_026_490_708) + .expect("out of bound"); let locale = "fr"; // date specifiers diff --git a/tests/it.rs b/tests/it.rs index 92d71f6..df3d4dc 100644 --- a/tests/it.rs +++ b/tests/it.rs @@ -7,7 +7,12 @@ use chrono_locale::LocaleDate; // This test is copied from chrono's, disabling unsupported features #[test] fn format_it() { - let dt = FixedOffset::east(34200).ymd(2001, 7, 8).and_hms_nano(0, 34, 59, 1_026_490_708); + let dt = FixedOffset::east_opt(34200) + .expect("out of bound") + .with_ymd_and_hms(2001, 7, 8, 0, 34, 59) + .unwrap() + .with_nanosecond(1_026_490_708) + .expect("out of bound"); let locale = "it"; // date specifiers diff --git a/tests/ja.rs b/tests/ja.rs index d2eda2e..7d1c55f 100644 --- a/tests/ja.rs +++ b/tests/ja.rs @@ -7,7 +7,12 @@ use chrono_locale::LocaleDate; // This test is copied from chrono's, disabling unsupported features #[test] fn format_it() { - let dt = FixedOffset::east(34200).ymd(2001, 7, 8).and_hms_nano(0, 34, 59, 1_026_490_708); + let dt = FixedOffset::east_opt(34200) + .expect("out of range") + .with_ymd_and_hms(2001, 7, 8, 0, 34, 59) + .unwrap() + .with_nanosecond(1_026_490_708) + .expect("out of range"); let locale = "ja"; // date specifiers diff --git a/tests/pt-br.rs b/tests/pt-br.rs index c549aa6..f461f95 100644 --- a/tests/pt-br.rs +++ b/tests/pt-br.rs @@ -7,7 +7,12 @@ use chrono_locale::LocaleDate; // This test is copied from chrono's, disabling unsupported features #[test] fn format_it() { - let dt = FixedOffset::east(34200).ymd(2001, 7, 8).and_hms_nano(0, 34, 59, 1_026_490_708); + let dt = FixedOffset::east_opt(34200) + .expect("out of range") + .with_ymd_and_hms(2001, 7, 8, 0, 34, 59) + .unwrap() + .with_nanosecond(1_026_490_708) + .expect("out of range"); let locale = "pt_BR"; // date specifiers diff --git a/tests/pt.rs b/tests/pt.rs index 94bc654..b36b6cb 100644 --- a/tests/pt.rs +++ b/tests/pt.rs @@ -7,7 +7,12 @@ use chrono_locale::LocaleDate; // This test is copied from chrono's, disabling unsupported features #[test] fn format_it() { - let dt = FixedOffset::east(34200).ymd(2001, 7, 8).and_hms_nano(0, 34, 59, 1_026_490_708); + let dt = FixedOffset::east_opt(34200) + .expect("out of range") + .with_ymd_and_hms(2001, 7, 8, 0, 34, 59) + .unwrap() + .with_nanosecond(1_026_490_708) + .expect("out of range"); let locale = "pt"; // date specifiers