From 359906c8bcde7e351540708777e3678fee0cc2c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= Date: Thu, 28 Apr 2022 10:33:23 +0200 Subject: cpp,tests: Verify that requested keylist mode is used * lang/cpp/tests/run-getkey.cpp, lang/cpp/tests/run-keylist.cpp (main): Check used keylist mode. -- Since Context::setKeyListMode() does not return the error returned by gpgme, we need to verify explicitly that the keylist mode was set successfully. GnuPG-bug-id: 5951 --- lang/cpp/tests/run-getkey.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lang/cpp/tests/run-getkey.cpp') diff --git a/lang/cpp/tests/run-getkey.cpp b/lang/cpp/tests/run-getkey.cpp index 67ca281c..c47da0b5 100644 --- a/lang/cpp/tests/run-getkey.cpp +++ b/lang/cpp/tests/run-getkey.cpp @@ -140,6 +140,12 @@ main (int argc, char **argv) return -1; } ctx->setKeyListMode (mode); + if (ctx->keyListMode() != mode) { + // unfortunately, Context::setKeyListMode() does not return the error + // returned by gpgme + std::cerr << "Failed to set keylist mode. You may have used an invalid combination of options."; + return -1; + } Error err; const GpgME::Key key = ctx->key (*argv, err, only_secret); std::stringstream ss; -- cgit v1.2.3