chore(tests): remove deprecated method usage

This commit is contained in:
Erica Marigold 2023-08-23 18:44:29 +05:30
parent c359068ce0
commit f8599bf8ef
No known key found for this signature in database
GPG key ID: 23CD97ABBBCC5ED2
8 changed files with 56 additions and 12 deletions

View file

@ -7,7 +7,12 @@ use chrono_locale::LocaleDate;
// This test is copied from chrono's, disabling unsupported features // This test is copied from chrono's, disabling unsupported features
#[test] #[test]
fn format_it() { 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"; let locale = "de";
// date specifiers // date specifiers

View file

@ -1,13 +1,18 @@
extern crate chrono; extern crate chrono;
extern crate chrono_locale; extern crate chrono_locale;
use chrono::{FixedOffset, TimeZone, Timelike, NaiveDateTime}; use chrono::{FixedOffset, TimeZone, Timelike};
use chrono_locale::LocaleDate; use chrono_locale::LocaleDate;
// This test is copied from chrono's, disabling unsupported features // This test is copied from chrono's, disabling unsupported features
#[test] #[test]
fn format_en() { 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"; let locale = "en";
// date specifiers // date specifiers
@ -82,10 +87,14 @@ fn format_en() {
assert_eq!(dt.formatl("%%", locale).to_string(), "%"); assert_eq!(dt.formatl("%%", locale).to_string(), "%");
} }
#[test] #[test]
fn format_en_naive() { 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 dt = dt.naive_local();
let locale = "en"; let locale = "en";

View file

@ -7,7 +7,12 @@ use chrono_locale::LocaleDate;
// This test is copied from chrono's, disabling unsupported features // This test is copied from chrono's, disabling unsupported features
#[test] #[test]
fn format_it() { 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"; let locale = "es";
// date specifiers // date specifiers

View file

@ -7,7 +7,12 @@ use chrono_locale::LocaleDate;
// This test is copied from chrono's, disabling unsupported features // This test is copied from chrono's, disabling unsupported features
#[test] #[test]
fn format_it() { 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"; let locale = "fr";
// date specifiers // date specifiers

View file

@ -7,7 +7,12 @@ use chrono_locale::LocaleDate;
// This test is copied from chrono's, disabling unsupported features // This test is copied from chrono's, disabling unsupported features
#[test] #[test]
fn format_it() { 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"; let locale = "it";
// date specifiers // date specifiers

View file

@ -7,7 +7,12 @@ use chrono_locale::LocaleDate;
// This test is copied from chrono's, disabling unsupported features // This test is copied from chrono's, disabling unsupported features
#[test] #[test]
fn format_it() { 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"; let locale = "ja";
// date specifiers // date specifiers

View file

@ -7,7 +7,12 @@ use chrono_locale::LocaleDate;
// This test is copied from chrono's, disabling unsupported features // This test is copied from chrono's, disabling unsupported features
#[test] #[test]
fn format_it() { 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"; let locale = "pt_BR";
// date specifiers // date specifiers

View file

@ -7,7 +7,12 @@ use chrono_locale::LocaleDate;
// This test is copied from chrono's, disabling unsupported features // This test is copied from chrono's, disabling unsupported features
#[test] #[test]
fn format_it() { 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"; let locale = "pt";
// date specifiers // date specifiers