From 4f2f158a207255e419eb2f74be3f4e760a605ade Mon Sep 17 00:00:00 2001 From: simonmar Date: Sun, 14 Jan 2001 15:46:53 +0000 Subject: [PATCH] [project @ 2001-01-14 15:46:53 by simonmar] Add a slightly stronger test for Time that the ones in tests/io. This one reads the current time, converts it to CalendarTime and back again, and tests that all three times converted to strings compare equal. --- ghc/tests/lib/should_run/time002.hs | 16 ++++++++++++++++ ghc/tests/lib/should_run/time002.stdout | 1 + 2 files changed, 17 insertions(+) create mode 100644 ghc/tests/lib/should_run/time002.hs create mode 100644 ghc/tests/lib/should_run/time002.stdout diff --git a/ghc/tests/lib/should_run/time002.hs b/ghc/tests/lib/should_run/time002.hs new file mode 100644 index 0000000..d3c3e42 --- /dev/null +++ b/ghc/tests/lib/should_run/time002.hs @@ -0,0 +1,16 @@ +import Time + +-- !!! check that we can read the current ClockTime, convert it +-- !!! to CalendarTime and back again, and that all three times when +-- !!! converted to strings compare equal. + +main = do + t <- getClockTime + let clock = show t + c <- toCalendarTime t + let cal = calendarTimeToString c + let t2 = toClockTime c + clock2 = show t2 + if (clock == cal && clock == clock2) + then putStrLn "Ok." + else putStrLn "Failed." diff --git a/ghc/tests/lib/should_run/time002.stdout b/ghc/tests/lib/should_run/time002.stdout new file mode 100644 index 0000000..587579a --- /dev/null +++ b/ghc/tests/lib/should_run/time002.stdout @@ -0,0 +1 @@ +Ok. -- 1.7.10.4