time.test: Use 'pass-if-equal' in more tests.
authorMark H Weaver <mhw@netris.org>
Fri, 31 May 2019 02:07:48 +0000 (22:07 -0400)
committerMark H Weaver <mhw@netris.org>
Tue, 18 Jun 2019 06:05:20 +0000 (02:05 -0400)
* test-suite/tests/time.test ("strftime"): Change some uses of 'pass-if'
to instead use 'pass-if-equal'.

test-suite/tests/time.test

index da7a48c042bc7936d85bb5b6ae79c8a35fa00842..2c829abfecb7aa9ed1625ba052fe8f3f6062dbd7 100644 (file)
 
 (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