guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 04/08: time.test: Use 'pass-if-equal' in more tests.


From: Mark H. Weaver
Subject: [Guile-commits] 04/08: time.test: Use 'pass-if-equal' in more tests.
Date: Tue, 18 Jun 2019 02:08:20 -0400 (EDT)

mhw pushed a commit to branch stable-2.2
in repository guile.

commit 75f3ba77596851724079670775e6c3ba3daf5929
Author: Mark H Weaver <address@hidden>
Date:   Thu May 30 22:07:48 2019 -0400

    time.test: Use 'pass-if-equal' in more tests.
    
    * test-suite/tests/time.test ("strftime"): Change some uses of 'pass-if'
    to instead use 'pass-if-equal'.
---
 test-suite/tests/time.test | 36 ++++++++++++++++++++----------------
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/test-suite/tests/time.test b/test-suite/tests/time.test
index da7a48c..2c829ab 100644
--- a/test-suite/tests/time.test
+++ b/test-suite/tests/time.test
@@ -195,37 +195,41 @@
 
 (with-test-prefix "strftime"
 
-  (pass-if "strftime %Z doesn't return garbage"
+  (pass-if-equal "strftime %Z doesn't return garbage"
+    "ZOW"
     (let ((t (localtime (current-time))))
       (set-tm:zone t "ZOW")
       (set-tm:isdst t 0)
-      (string=? (strftime "%Z" t)
-                "ZOW")))
+      (strftime "%Z" t)))
 
-  (pass-if "strftime passes wide characters"
+  (pass-if-equal "strftime passes wide characters"
+      "\u0100"
     (let ((t (localtime (current-time))))
-      (string=? (substring (strftime "\u0100%Z" t) 0 1)
-                "\u0100")))
+      (substring (strftime "\u0100%Z" t) 0 1)))
 
   (with-test-prefix "C99 %z format"
 
     ;; %z here is quite possibly affected by the same tm:gmtoff vs current
     ;; zone as %Z above is, so in the following tests we make them the same.
 
-    (pass-if "GMT"
-      (putenv "TZ=GMT+0")
-      (tzset)
-      (let ((tm (localtime 86400)))
-       (string=? "+0000" (strftime "%z" tm))))
+    (pass-if-equal "GMT"
+        "+0000"
+      (begin
+        (putenv "TZ=GMT+0")
+        (tzset)
+        (let ((tm (localtime 86400)))
+          (strftime "%z" tm))))
 
     ;; prior to guile 1.6.9 and 1.8.1 this test failed, getting "+0500",
     ;; because we didn't adjust for tm:gmtoff being west of Greenwich versus
     ;; tm_gmtoff being east of Greenwich
-    (pass-if "EST+5"
-      (putenv "TZ=EST+5")
-      (tzset)
-      (let ((tm (localtime 86400)))
-       (string=? "-0500" (strftime "%z" tm))))))
+    (pass-if-equal "EST+5"
+        "-0500"
+      (begin
+        (putenv "TZ=EST+5")
+        (tzset)
+        (let ((tm (localtime 86400)))
+          (strftime "%z" tm))))))
 
 ;;;
 ;;; strptime



reply via email to

[Prev in Thread] Current Thread [Next in Thread]