[Pkg-gnupg-commit] [gnupg2] 61/180: tests: Rename 'error' to 'fail'.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Sat Dec 24 22:29:08 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository gnupg2.

commit 5b5d881f47c82f320abf440c20b7a1bac078a987
Author: Justus Winter <justus at g10code.com>
Date:   Tue Dec 6 15:21:30 2016 +0100

    tests: Rename 'error' to 'fail'.
    
    * tests/gpgscm/tests.scm (error): Rename to 'fail'.  'error' is a
    primitive function (an opcode) of the TinySCHEME vm, and 'error' is
    also defined by R6RS.  Better avoid redefining that.  Fix all call
    sites.
    * tests/openpgp/4gb-packet.scm: Adapt.
    * tests/openpgp/decrypt-multifile.scm: Likewise.
    * tests/openpgp/ecc.scm: Likewise.
    * tests/openpgp/export.scm: Likewise.
    * tests/openpgp/gpgtar.scm: Likewise.
    * tests/openpgp/gpgv-forged-keyring.scm: Likewise.
    * tests/openpgp/import.scm: Likewise.
    * tests/openpgp/issue2015.scm: Likewise.
    * tests/openpgp/issue2346.scm: Likewise.
    * tests/openpgp/issue2419.scm: Likewise.
    * tests/openpgp/key-selection.scm: Likewise.
    * tests/openpgp/mds.scm: Likewise.
    * tests/openpgp/multisig.scm: Likewise.
    * tests/openpgp/setup.scm: Likewise.
    * tests/openpgp/signencrypt.scm: Likewise.
    * tests/openpgp/ssh-import.scm: Likewise.
    * tests/openpgp/tofu.scm: Likewise.
    * tests/openpgp/verify.scm: Likewise.
    
    Signed-off-by: Justus Winter <justus at g10code.com>
---
 tests/gpgscm/tests.scm                | 12 ++++++------
 tests/openpgp/4gb-packet.scm          |  2 +-
 tests/openpgp/decrypt-multifile.scm   |  2 +-
 tests/openpgp/ecc.scm                 |  4 ++--
 tests/openpgp/export.scm              |  4 ++--
 tests/openpgp/gpgtar.scm              |  4 ++--
 tests/openpgp/gpgv-forged-keyring.scm |  2 +-
 tests/openpgp/import.scm              |  2 +-
 tests/openpgp/issue2015.scm           |  2 +-
 tests/openpgp/issue2346.scm           |  2 +-
 tests/openpgp/issue2419.scm           |  2 +-
 tests/openpgp/key-selection.scm       |  2 +-
 tests/openpgp/mds.scm                 |  2 +-
 tests/openpgp/multisig.scm            |  2 +-
 tests/openpgp/setup.scm               |  2 +-
 tests/openpgp/signencrypt.scm         |  2 +-
 tests/openpgp/ssh-import.scm          |  6 +++---
 tests/openpgp/tofu.scm                | 16 ++++++++--------
 tests/openpgp/verify.scm              |  6 +++---
 19 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/tests/gpgscm/tests.scm b/tests/gpgscm/tests.scm
index 1c170b0..e2b38f5 100644
--- a/tests/gpgscm/tests.scm
+++ b/tests/gpgscm/tests.scm
@@ -42,7 +42,7 @@
   (if (> (*verbose*) 0)
       (apply info msg)))
 
-(define (error . msg)
+(define (fail . msg)
   (apply info msg)
   (exit 1))
 
@@ -325,7 +325,7 @@
   (lettmp (sink)
 	  (transformer source sink)
 	  (if (not (file=? source sink))
-	      (error "mismatch"))))
+	      (fail "mismatch"))))
 
 ;;
 ;; Monadic pipe support.
@@ -440,7 +440,7 @@
 (define (tr:spawn input command)
   (lambda (tmpfiles source)
     (if (and (member '**in** command) (not source))
-	(error (string-append (stringify cmd) " needs an input")))
+	(fail (string-append (stringify cmd) " needs an input")))
     (let* ((t (make-temporary-file))
 	   (cmd (map (lambda (x)
 		       (cond
@@ -450,7 +450,7 @@
       (catch (list (cons t tmpfiles) t *error*)
 	     (call-popen cmd input)
 	     (if (and (member '**out** command) (not (file-exists? t)))
-		 (error (string-append (stringify cmd)
+		 (fail (string-append (stringify cmd)
 				       " did not produce '" t "'.")))
 	     (list (cons t tmpfiles) t #f)))))
 
@@ -471,13 +471,13 @@
 (define (tr:assert-identity reference)
   (lambda (tmpfiles source)
     (if (not (file=? source reference))
-	(error "mismatch"))
+	(fail "mismatch"))
     (list tmpfiles source #f)))
 
 (define (tr:assert-weak-identity reference)
   (lambda (tmpfiles source)
     (if (not (text-file=? source reference))
-	(error "mismatch"))
+	(fail "mismatch"))
     (list tmpfiles source #f)))
 
 (define (tr:call-with-content function . args)
diff --git a/tests/openpgp/4gb-packet.scm b/tests/openpgp/4gb-packet.scm
index 9c387af..b827181 100755
--- a/tests/openpgp/4gb-packet.scm
+++ b/tests/openpgp/4gb-packet.scm
@@ -25,4 +25,4 @@
 
 (if (= 0 (call `(, at GPG --list-packets ,(in-srcdir "4gb-packet.asc"))))
   (info "Can parse 4GB packets.")
-  (error "Failed to parse 4GB packet."))
+  (fail "Failed to parse 4GB packet."))
diff --git a/tests/openpgp/decrypt-multifile.scm b/tests/openpgp/decrypt-multifile.scm
index 4efdf66..a7695b1 100755
--- a/tests/openpgp/decrypt-multifile.scm
+++ b/tests/openpgp/decrypt-multifile.scm
@@ -43,5 +43,5 @@
   "Verifying files:"
   (lambda (name)
     (unless (file=? (path-join my-wd name) name)
-	    (error "decrypted file differs")))
+	    (fail "decrypted file differs")))
   plain-files))
diff --git a/tests/openpgp/ecc.scm b/tests/openpgp/ecc.scm
index 2190b9b..a40869d 100755
--- a/tests/openpgp/ecc.scm
+++ b/tests/openpgp/ecc.scm
@@ -103,7 +103,7 @@ Ic1RdzgeCfosMF+l/zVRchcLKzenEQA=
 	   x (lambda (p) (display (eval test (current-environment)) p)))
        (call-check `(,(tool 'gpg) --verify ,x))
        (call-check `(,(tool 'gpg) --output ,y ,x))
-       (unless (file=? y z) (error "mismatch"))))
+       (unless (file=? y z) (fail "mismatch"))))
    '(msg_opaque_signed_256 msg_opaque_signed_384 msg_opaque_signed_521)))
 
 ;;
@@ -182,7 +182,7 @@ Rg==
        (call-with-output-file
 	   x (lambda (p) (display (eval test (current-environment)) p)))
        (call-check `(, at GPG --yes --output ,y ,x))
-       (unless (file=? y z) (error "mismatch"))))
+       (unless (file=? y z) (fail "mismatch"))))
    '(msg_encrypted_256 msg_encrypted_384 msg_encrypted_521)))
 
 ;;
diff --git a/tests/openpgp/export.scm b/tests/openpgp/export.scm
index a79411c..c10fc81 100755
--- a/tests/openpgp/export.scm
+++ b/tests/openpgp/export.scm
@@ -22,7 +22,7 @@
 
 (define (check-for predicate lines message)
   (unless (any predicate lines)
-	  (error message)))
+	  (fail message)))
 
 (define (check-exported-key dump keyid)
   (check-for (lambda (l)
@@ -68,7 +68,7 @@
      (lambda (port)
        (unless
 	(eof-object? (peek-char port))
-	(error (string-append
+	(fail (string-append
 		"Expected all passphrases to be consumed, but found: "
 		(read-all port)))))))
 
diff --git a/tests/openpgp/gpgtar.scm b/tests/openpgp/gpgtar.scm
index cd692de..c88589f 100755
--- a/tests/openpgp/gpgtar.scm
+++ b/tests/openpgp/gpgtar.scm
@@ -43,7 +43,7 @@
      (tr:call-with-content
       (lambda (c)
 	(unless (all (lambda (f) (string-contains? c f)) testfiles)
-		(error "some file(s) are missing from archive")))))
+		(fail "some file(s) are missing from archive")))))
 
     (with-temporary-working-directory
      (call-check `(,(tool 'gpgtar) --gpg ,(tool 'gpg) --gpg-args ,gpgargs
@@ -53,7 +53,7 @@
 
      (for-each
       (lambda (f) (unless (call-with-input-file f (lambda (x) #t))
-			  (error (string-append "missing file: " f))))
+			  (fail (string-append "missing file: " f))))
       testfiles))))
 
 (info "Checking gpgtar without encryption")
diff --git a/tests/openpgp/gpgv-forged-keyring.scm b/tests/openpgp/gpgv-forged-keyring.scm
index 65d21c5..6885cd9 100755
--- a/tests/openpgp/gpgv-forged-keyring.scm
+++ b/tests/openpgp/gpgv-forged-keyring.scm
@@ -64,5 +64,5 @@ N1Glbw1OJfP1q+QFPMPKoCsTYmZpuugq2b5gV/eH0Abvk2pG4Fo/YTDPHhec7Jk=
 	  (pipe:do
 	   (pipe:echo (eval armored-file (current-environment)))
 	   (pipe:spawn `(, at GPGV --keyring ,(in-srcdir "forged-keyring.gpg"))))
-	  (error "verification succeeded but should not")))
+	  (fail "verification succeeded but should not")))
  '(msg_signed_asc))
diff --git a/tests/openpgp/import.scm b/tests/openpgp/import.scm
index c354753..3b41746 100755
--- a/tests/openpgp/import.scm
+++ b/tests/openpgp/import.scm
@@ -58,4 +58,4 @@
 			(string-contains? line ":4096:1:DDA252EBB8EBE1AF:")))
 		 (string-split-newlines c))))
       (unless (= 2 (length keys))
-	      (error "Importing keys with long id collision failed"))))))
+	      (fail "Importing keys with long id collision failed"))))))
diff --git a/tests/openpgp/issue2015.scm b/tests/openpgp/issue2015.scm
index 4f151aa..39df333 100755
--- a/tests/openpgp/issue2015.scm
+++ b/tests/openpgp/issue2015.scm
@@ -28,4 +28,4 @@
 			    "GET_PASSPHRASE --no-ask some_id X X X")))
   (unless (string=? (string-rtrim char-whitespace? response)
 		    "OK 736F6D655F70617373706872617365")
-	  (error "Could not retrieve passphrase from cache:" response)))
+	  (fail "Could not retrieve passphrase from cache:" response)))
diff --git a/tests/openpgp/issue2346.scm b/tests/openpgp/issue2346.scm
index cbe03f9..9765453 100755
--- a/tests/openpgp/issue2346.scm
+++ b/tests/openpgp/issue2346.scm
@@ -25,4 +25,4 @@
 (info "Checking import statistics (issue2346)...")
 (let ((status (call-popen `(, at GPG --status-fd=1 --import ,key) "")))
   (unless (string-contains? status "IMPORT_RES 1 0 1 0 0 0 0 0 0 1 1 0 0 0 0")
-	  (error "Unexpected number of keys imported" status)))
+	  (fail "Unexpected number of keys imported" status)))
diff --git a/tests/openpgp/issue2419.scm b/tests/openpgp/issue2419.scm
index 9b67851..e397a88 100755
--- a/tests/openpgp/issue2419.scm
+++ b/tests/openpgp/issue2419.scm
@@ -26,4 +26,4 @@
  (dearmor (in-srcdir "samplemsgs/issue2419.asc") onebyte)
  (catch (assert (string-contains? (car *error*) "invalid packet"))
 	(call-popen `(, at GPG --list-packets ,onebyte) "")
-	(error "Expected an error but got none")))
+	(fail "Expected an error but got none")))
diff --git a/tests/openpgp/key-selection.scm b/tests/openpgp/key-selection.scm
index 93bd001..020c9b4 100644
--- a/tests/openpgp/key-selection.scm
+++ b/tests/openpgp/key-selection.scm
@@ -76,7 +76,7 @@
 	     (display (call-popen `(, at gpg --locate-key ,mailbox) ""))
 	     (echo "This is the key we expected:")
 	     (display (call-popen `(, at gpg --list-keys ,expected) ""))
-	     (error "Expected" expected "but got" fpr)))
+	     (fail "Expected" expected "but got" fpr)))
    (delete-keys set))
  (lambda (set)
    (length set))
diff --git a/tests/openpgp/mds.scm b/tests/openpgp/mds.scm
index bf598eb..fb468e5 100755
--- a/tests/openpgp/mds.scm
+++ b/tests/openpgp/mds.scm
@@ -49,7 +49,7 @@
 (define (test-hash hash ref)
   (unless (eq? #f ref)
 	  (if (not (string=? (:value hash) (:value ref)))
-	    (error "failed"))))
+	    (fail "failed"))))
 
 ;; Test whether the hashes computed over S match the REFERENCE set.
 (define (test-hashes msg s reference)
diff --git a/tests/openpgp/multisig.scm b/tests/openpgp/multisig.scm
index 7f1c4c5..c643ac8 100755
--- a/tests/openpgp/multisig.scm
+++ b/tests/openpgp/multisig.scm
@@ -164,6 +164,6 @@ cnksIEkgY2FuJ3QgZG8gdGhhdAo=
       (pipe:write-to file (logior O_WRONLY O_CREAT O_BINARY) #o600))
 
      (if (= 0 (call `(, at GPG --verify ,file)))
-	 (error "Bad signature verified ok"))))
+	 (fail "Bad signature verified ok"))))
  '(sig-1ls1ls-valid sig-ls-valid sig-1lsls-invalid
 		    sig-lsls-invalid sig-lss-invalid sig-slsl-invalid))
diff --git a/tests/openpgp/setup.scm b/tests/openpgp/setup.scm
index d2e125e..fc0615f 100755
--- a/tests/openpgp/setup.scm
+++ b/tests/openpgp/setup.scm
@@ -20,7 +20,7 @@
 (load (with-path "defs.scm"))
 
 (unless (member "--create-tarball" *args*)
-	(error "Usage: setup.scm --create-tarball <file>"))
+	(fail "Usage: setup.scm --create-tarball <file>"))
 
 (with-temporary-working-directory
  (setenv "GNUPGHOME" (getcwd) #t)
diff --git a/tests/openpgp/signencrypt.scm b/tests/openpgp/signencrypt.scm
index b4c3bd6..35ac89a 100755
--- a/tests/openpgp/signencrypt.scm
+++ b/tests/openpgp/signencrypt.scm
@@ -37,4 +37,4 @@
 	      usrpass1)
   (if (not (string=? "4336AE2A528FAE091E73E59E325B588FEE795F9B"
 		     (cadar (gpg-hash-string `(--print-md SHA1 ,tmp) ""))))
-      (error "bug537-test.data.asc: mismatch (bug 537)")))
+      (fail "bug537-test.data.asc: mismatch (bug 537)")))
diff --git a/tests/openpgp/ssh-import.scm b/tests/openpgp/ssh-import.scm
index a825409..e8f12d3 100755
--- a/tests/openpgp/ssh-import.scm
+++ b/tests/openpgp/ssh-import.scm
@@ -22,7 +22,7 @@
 
 (define GNUPGHOME (getenv "GNUPGHOME"))
 (if (string=? "" GNUPGHOME)
-    (error "GNUPGHOME not set"))
+    (fail "GNUPGHOME not set"))
 
 (setenv "SSH_AUTH_SOCK"
         (call-check `(,(tool 'gpgconf) --null --list-dirs agent-ssh-socket))
@@ -51,7 +51,7 @@
       (pipe:open file (logior O_RDONLY O_BINARY))
       (pipe:spawn `(,SSH-ADD -)))
      (unless (string-contains? (call-popen `(,SSH-ADD -l "-E" md5) "") hash)
-	     (error "key not added"))))
+	     (fail "key not added"))))
  car keys)
 
 (info "Checking for issue2316...")
@@ -64,4 +64,4 @@
 (unless
  (string-contains? (call-popen `(,SSH-ADD -l "-E" md5) "")
 		   "c9:85:b5:55:00:84:a9:82:5a:df:d6:62:1b:5a:28:22")
- (error "known private key not (re-)added to sshcontrol"))
+ (fail "known private key not (re-)added to sshcontrol"))
diff --git a/tests/openpgp/tofu.scm b/tests/openpgp/tofu.scm
index f9dc411..47c3dd0 100755
--- a/tests/openpgp/tofu.scm
+++ b/tests/openpgp/tofu.scm
@@ -25,7 +25,7 @@
 	      --faked-system-time=1480943782))
 (define GNUPGHOME (getenv "GNUPGHOME"))
 (if (string=? "" GNUPGHOME)
-    (error "GNUPGHOME not set"))
+    (fail "GNUPGHOME not set"))
 
 (catch (skip "Tofu not supported")
        (call-check `(, at GPG --trust-model=tofu --list-config)))
@@ -37,7 +37,7 @@
             (call-check `(, at GPG --import
                                 ,(in-srcdir "tofu/conflicting/"
                                             (string-append keyid ".gpg"))))
-	    (catch (error "Missing key" keyid)
+	    (catch (fail "Missing key" keyid)
 		   (call-check `(, at GPG --list-keys ,keyid))))
 	  KEYS)
 
@@ -52,7 +52,7 @@
 				   , at args
 				   --list-keys ,keyid))) 5)))
     (unless (member policy '("auto" "good" "unknown" "bad" "ask"))
-	    (error "Bad policy:" policy))
+	    (fail "Bad policy:" policy))
     policy))
 
 ;; Check that KEYID's tofu policy matches EXPECTED-POLICY.  Any
@@ -62,7 +62,7 @@
 (define (checkpolicy keyid expected-policy . args)
   (let ((policy (apply getpolicy `(,keyid , at args))))
     (unless (string=? policy expected-policy)
-	    (error keyid ": Expected policy to be" expected-policy
+	    (fail keyid ": Expected policy to be" expected-policy
 		   "but got" policy))))
 
 ;; Get the trust level for KEYID.  Any remaining arguments are simply
@@ -77,7 +77,7 @@
 				   --list-keys ,keyid))) 1)))
     (unless (and (= 1 (string-length trust))
 		 (member (string-ref trust 0) (string->list "oidreqnmfuws-")))
-	    (error "Bad trust value:" trust))
+	    (fail "Bad trust value:" trust))
     trust))
 
 ;; Check that KEYID's trust level matches EXPECTED-TRUST.  Any
@@ -87,7 +87,7 @@
 (define (checktrust keyid expected-trust . args)
   (let ((trust (apply gettrust `(,keyid , at args))))
     (unless (string=? trust expected-trust)
-	    (error keyid ": Expected trust to be" expected-trust
+	    (fail keyid ": Expected trust to be" expected-trust
 		   "but got" trust))))
 
 ;; Set key KEYID's policy to POLICY.  Any remaining arguments are
@@ -177,10 +177,10 @@
        (sigs (string->number (list-ref tfs 3)))
        (encs (string->number (list-ref tfs 4))))
     (unless (= sigs expected-sigs)
-            (error keyid ": # signatures (" sigs ") does not match expected"
+            (fail keyid ": # signatures (" sigs ") does not match expected"
                    "# signatures (" expected-sigs ").\n"))
     (unless (= encs expected-encs)
-            (error keyid ": # encryptions (" encs ") does not match expected"
+            (fail keyid ": # encryptions (" encs ") does not match expected"
                    "# encryptions (" expected-encs ").\n"))
     ))
 
diff --git a/tests/openpgp/verify.scm b/tests/openpgp/verify.scm
index 2c2c14a..a398a14 100755
--- a/tests/openpgp/verify.scm
+++ b/tests/openpgp/verify.scm
@@ -33,7 +33,7 @@
 	(display (make-string 64 (integer->char (string->number char)))
 		 port)))
      (if (= 0 (call `(, at GPG --verify ,x data-500)))
-	 (error "no error code from verify"))))
+	 (fail "no error code from verify"))))
  '("#x2d" "#xca"))
 
 ;; A plain signed message created using
@@ -324,7 +324,7 @@ GisM
 	   (pipe:defer (lambda (sink)
 			 (display armored-file (fdopen sink "w"))))
 	   (pipe:spawn `(, at GPG --verify)))
-	  (error "verification succeeded but should not")))
+	  (fail "verification succeeded but should not")))
  '(msg_olsols_asc_multiple msg_clsclss_asc_multiple))
 
 (for-each-p
@@ -334,7 +334,7 @@ GisM
 	  (pipe:do
 	   (pipe:echo (eval armored-file (current-environment)))
 	   (pipe:spawn `(, at GPG --verify)))
-	  (error "verification succeeded but should not")))
+	  (fail "verification succeeded but should not")))
  '(bad_ls_asc bad_fols_asc bad_olsf_asc bad_ools_asc))
 
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list