Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

temporary hack to make testing std::time reliable #2259

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions src/libstd/time.rs
Original file line number Diff line number Diff line change
@@ -824,6 +824,18 @@ mod tests {
import task;

#[test]
fn test_all() {
test_get_time();
test_precise_time();
test_at_utc();
test_at();
test_to_timespec();
test_conversions();
test_strptime();
test_ctime();
test_strftime();
}

fn test_get_time() {
const some_recent_date: i64 = 1325376000i64; // 2012-01-01T00:00:00Z
const some_future_date: i64 = 1577836800i64; // 2020-01-01T00:00:00Z
@@ -847,7 +859,6 @@ mod tests {
}
}

#[test]
fn test_precise_time() {
let s0 = precise_time_s();
let ns1 = precise_time_ns();
@@ -865,7 +876,6 @@ mod tests {
assert ns2 >= ns1;
}

#[test]
fn test_at_utc() {
os::setenv("TZ", "America/Los_Angeles");

@@ -886,7 +896,6 @@ mod tests {
assert utc.tm_nsec == 54321_i32;
}

#[test]
fn test_at() {
os::setenv("TZ", "America/Los_Angeles");

@@ -912,7 +921,6 @@ mod tests {
assert local.tm_nsec == 54321_i32;
}

#[test]
fn test_to_timespec() {
os::setenv("TZ", "America/Los_Angeles");

@@ -923,7 +931,6 @@ mod tests {
assert utc.to_local().to_timespec() == time;
}

#[test]
fn test_conversions() {
os::setenv("TZ", "America/Los_Angeles");

@@ -939,7 +946,6 @@ mod tests {
assert utc.to_local().to_utc() == utc;
}

#[test]
fn test_strptime() {
os::setenv("TZ", "America/Los_Angeles");

@@ -1084,7 +1090,6 @@ mod tests {
assert test("%", "%%");
}

#[test]
fn test_ctime() {
os::setenv("TZ", "America/Los_Angeles");

@@ -1096,7 +1101,6 @@ mod tests {
assert local.ctime() == "Fri Feb 13 15:31:30 2009";
}

#[test]
fn test_strftime() {
os::setenv("TZ", "America/Los_Angeles");