Skip to content

Commit 340dbcf

Browse files
tedhorstbrson
authored andcommitted
temporary hack to make testing std::time reliable
1 parent 825fd18 commit 340dbcf

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/libstd/time.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,18 @@ mod tests {
824824
import task;
825825

826826
#[test]
827+
fn test_all() {
828+
test_get_time();
829+
test_precise_time();
830+
test_at_utc();
831+
test_at();
832+
test_to_timespec();
833+
test_conversions();
834+
test_strptime();
835+
test_ctime();
836+
test_strftime();
837+
}
838+
827839
fn test_get_time() {
828840
const some_recent_date: i64 = 1325376000i64; // 2012-01-01T00:00:00Z
829841
const some_future_date: i64 = 1577836800i64; // 2020-01-01T00:00:00Z
@@ -847,7 +859,6 @@ mod tests {
847859
}
848860
}
849861

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

868-
#[test]
869879
fn test_at_utc() {
870880
os::setenv("TZ", "America/Los_Angeles");
871881

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

889-
#[test]
890899
fn test_at() {
891900
os::setenv("TZ", "America/Los_Angeles");
892901

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

915-
#[test]
916924
fn test_to_timespec() {
917925
os::setenv("TZ", "America/Los_Angeles");
918926

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

926-
#[test]
927934
fn test_conversions() {
928935
os::setenv("TZ", "America/Los_Angeles");
929936

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

942-
#[test]
943949
fn test_strptime() {
944950
os::setenv("TZ", "America/Los_Angeles");
945951

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

1087-
#[test]
10881093
fn test_ctime() {
10891094
os::setenv("TZ", "America/Los_Angeles");
10901095

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

1099-
#[test]
11001104
fn test_strftime() {
11011105
os::setenv("TZ", "America/Los_Angeles");
11021106

0 commit comments

Comments
 (0)