rust_toolchain/channel/
nightly.rs1use crate::Date;
2
3#[derive(Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)]
7pub struct Nightly {
8 pub date: Date,
10}
11
12impl Nightly {
13 pub fn new(year: u16, month: u8, day: u8) -> Self {
15 Self {
16 date: Date::new(year, month, day),
17 }
18 }
19}
20
21#[cfg(test)]
22mod tests {
23 use crate::{Date, channel::Nightly};
24
25 #[yare::parameterized(
26 patch1 = { Date::new(0, 0, 0), Date::new(0, 0, 1) },
27 minor1 = { Date::new(0, 0, 0), Date::new(0, 1, 0) },
28 major1 = { Date::new(0, 0, 0), Date::new(1, 0, 0) },
29 minor_over_patch = { Date::new(0, 0, 99), Date::new(0, 1, 0) },
30 major_over_patch = { Date::new(0, 0, 99), Date::new(1, 0, 0) },
31 major_over_minor = { Date::new(0, 99, 0), Date::new(1, 0, 0) },
32 )]
33 fn ord(left: Date, right: Date) {
34 let left = Nightly { date: left };
35 let right = Nightly { date: right };
36
37 assert!(left < right);
38 }
39}