diff options
Diffstat (limited to 'src/zip/tests.rs')
| -rw-r--r-- | src/zip/tests.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/zip/tests.rs b/src/zip/tests.rs index e24cdfe..a8ac634 100644 --- a/src/zip/tests.rs +++ b/src/zip/tests.rs | |||
| @@ -1,5 +1,7 @@ | |||
| 1 | use crate::zip::cp437::{from_char, is_cp437, to_char, FromCp437}; | 1 | use crate::zip::cp437::{from_char, is_cp437, to_char, FromCp437}; |
| 2 | use crate::zip::datetime::DosDateTime; | ||
| 2 | use crate::zip::{bit::DeflateMode, BitFlag}; | 3 | use crate::zip::{bit::DeflateMode, BitFlag}; |
| 4 | use chrono::{DateTime, Local, TimeZone}; | ||
| 3 | 5 | ||
| 4 | #[test] | 6 | #[test] |
| 5 | fn test_bit_flag() { | 7 | fn test_bit_flag() { |
| @@ -74,3 +76,20 @@ fn test_cp437() { | |||
| 74 | "abcdefghijklmnopqrstuvwxyz" | 76 | "abcdefghijklmnopqrstuvwxyz" |
| 75 | ); | 77 | ); |
| 76 | } | 78 | } |
| 79 | |||
| 80 | #[test] | ||
| 81 | fn test_dos_datetime() { | ||
| 82 | let datetime = Local.with_ymd_and_hms(2001, 2, 3, 4, 5, 6).unwrap(); | ||
| 83 | assert_eq!( | ||
| 84 | DateTime::from_dos_date_time(datetime.to_dos_date(), datetime.to_dos_time(), Local) | ||
| 85 | .unwrap(), | ||
| 86 | datetime | ||
| 87 | ); | ||
| 88 | |||
| 89 | let datetime = Local.with_ymd_and_hms(1999, 9, 9, 9, 9, 9).unwrap(); | ||
| 90 | assert_eq!( | ||
| 91 | DateTime::from_dos_date_time(datetime.to_dos_date(), datetime.to_dos_time(), Local) | ||
| 92 | .unwrap(), | ||
| 93 | Local.with_ymd_and_hms(1999, 9, 9, 9, 9, 8).unwrap() | ||
| 94 | ); // Dos format stores seconds with an accuracy of 2s | ||
| 95 | } | ||
