[git] GpgOL - branch, master, updated. gpgol-2.3.1-20-gef333f9

by Andre Heinecke cvs at cvs.gnupg.org
Mon Oct 29 13:49:40 CET 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG extension for MS Outlook".

The branch, master has been updated
       via  ef333f9d9021a0c3039eda0139986321dfdb9bbd (commit)
      from  e193d2e3c721a3ab92d3479ddc7d59039265d682 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ef333f9d9021a0c3039eda0139986321dfdb9bbd
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Mon Oct 29 13:49:15 2018 +0100

    tests: Add repeats option to parser runner
    
    * tests/run-parser.cpp: Add repeats option.

diff --git a/tests/run-parser.cpp b/tests/run-parser.cpp
index b908360..d4a595e 100644
--- a/tests/run-parser.cpp
+++ b/tests/run-parser.cpp
@@ -36,6 +36,7 @@ show_usage (int ex)
          "  --opaque-encrypted    SMIME opaque encrypted\n"
          "  --clear-signed        clearsigned\n"
          "  --pgp-message         inline pgp message\n"
+         "  --repeat N            repeat N times\n"
          , stderr);
   exit (ex);
 }
@@ -45,6 +46,7 @@ int main(int argc, char **argv)
   int last_argc = -1;
   msgtype_t msgtype = MSGTYPE_UNKNOWN;
   FILE *fp_in = NULL;
+  int repeats = 1;
 
   gpgme_check_version (NULL);
 
@@ -98,29 +100,43 @@ int main(int argc, char **argv)
           msgtype = MSGTYPE_GPGOL_PGP_MESSAGE;
           argc--; argv++;
         }
+      else if (!strcmp (*argv, "--repeat"))
+        {
+            argc--; argv++;
+            if (!argc)
+                show_usage (1);
+            repeats = atoi (*argv);
+            argc--; argv++;
+        }
     }
   if (argc < 1 || argc > 2)
     show_usage (1);
 
-  fp_in = fopen (argv[0], "rb");
-
-  if (fp_in)
+  for (int i = 0; i < repeats; i++)
     {
-      ParseController parser(fp_in, msgtype);
-      parser.parse();
-      std::cout << "Parse error: " << parser.get_formatted_error ();
-      std::cout << "\nDecrypt result:\n" << parser.decrypt_result()
-                << "\nVerify result:\n" << parser.verify_result()
-                << "\nBEGIN BODY\n" << parser.get_body() << "\nEND BODY"
-                << "\nBEGIN HTML\n" << parser.get_html_body() << "\nEND HTML";
-      for (auto attach: parser.get_attachments())
+      std::cout << "Run: " << i;
+      fp_in = fopen (argv[0], "rb");
+
+      if (fp_in)
         {
-          std::cout << "Attachment: " << attach->get_display_name();
+          ParseController parser(fp_in, msgtype);
+          parser.setSender("test at example.com");
+          parser.parse();
+          std::cout << "Parse error: " << parser.get_formatted_error ();
+          std::cout << "\nDecrypt result:\n" << parser.decrypt_result()
+            << "\nVerify result:\n" << parser.verify_result()
+            << "\nBEGIN BODY\n" << parser.get_body() << "\nEND BODY"
+            << "\nBEGIN HTML\n" << parser.get_html_body() << "\nEND HTML";
+          for (auto attach: parser.get_attachments())
+            {
+              std::cout << "Attachment: " << attach->get_display_name();
+            }
+          fclose (fp_in);
         }
-      fclose (fp_in);
-    }
-  else
-    {
-      std::cout << "failed to open input: " << argv[0];
+      else
+        {
+          std::cout << "failed to open input: " << argv[0];
+        }
+
     }
 }

-----------------------------------------------------------------------

Summary of changes:
 tests/run-parser.cpp | 50 +++++++++++++++++++++++++++++++++-----------------
 1 file changed, 33 insertions(+), 17 deletions(-)


hooks/post-receive
-- 
GnuPG extension for MS Outlook
http://git.gnupg.org




More information about the Gnupg-commits mailing list