We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
cargo wasi test
1 parent c220598 commit 673315bCopy full SHA for 673315b
src/time.rs
@@ -168,11 +168,14 @@ mod tests {
168
169
#[test]
170
fn truncates_at_unix_epoch() {
171
- let before_epoch = SystemTime::UNIX_EPOCH - Duration::from_secs(100);
172
- assert!(before_epoch < SystemTime::UNIX_EPOCH);
173
- assert_eq!(
174
- Ulid::from_datetime(before_epoch).datetime(),
175
- SystemTime::UNIX_EPOCH
176
- );
+ if let Some(before_epoch) = SystemTime::UNIX_EPOCH.checked_sub(Duration::from_secs(100)) {
+ assert!(before_epoch < SystemTime::UNIX_EPOCH);
+ assert_eq!(
+ Ulid::from_datetime(before_epoch).datetime(),
+ SystemTime::UNIX_EPOCH
+ );
177
+ } else {
178
+ // Prior dates are not representable (e.g. wasm32-wasi)
179
+ }
180
}
181
0 commit comments