mirror of
https://github.com/0x5eal/chrono-lc.git
synced 2025-01-19 09:08:05 +00:00
chore(tests): remove deprecated method usage
This commit is contained in:
parent
c359068ce0
commit
f8599bf8ef
8 changed files with 56 additions and 12 deletions
|
@ -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
|
||||
|
|
17
tests/en.rs
17
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";
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue