File: ymd_to_date.rs

package info (click to toggle)
rust-datetime 0.5.2-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 728 kB
  • sloc: ruby: 18; makefile: 6
file content (33 lines) | stat: -rw-r--r-- 737 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
extern crate datetime;
use datetime::{LocalDate, Month};
use datetime::{DatePiece};


#[test]
fn the_distant_past() {
    let date = LocalDate::ymd(7, Month::April, 1).unwrap();

    assert_eq!(date.year(),  7);
    assert_eq!(date.month(), Month::April);
    assert_eq!(date.day(),   1);
}


#[test]
fn the_distant_present() {
    let date = LocalDate::ymd(2015, Month::January, 16).unwrap();

    assert_eq!(date.year(),  2015);
    assert_eq!(date.month(), Month::January);
    assert_eq!(date.day(),   16);
}


#[test]
fn the_distant_future() {
    let date = LocalDate::ymd(1048576, Month::October, 13).unwrap();

    assert_eq!(date.year(), 1048576);
    assert_eq!(date.month(), Month::October);
    assert_eq!(date.day(), 13);
}