Commit Graph

7 Commits

Author SHA1 Message Date
Andre Heinecke
dd4b80a5f6
tests,json: Add the bulk of tests
* t-json.c (tests): Register new tests.
* t-createkey.in.json,
  t-createkey.out.json,
  t-decrypt-verify.in.json,
  t-decrypt-verify.out.json,
  t-decrypt.in.json,
  t-decrypt.out.json,
  t-delete.in.json,
  t-delete.out.json,
  t-encrypt-sign.in.json,
  t-encrypt-sign.out.json,
  t-encrypt.in.json,
  t-encrypt.out.json,
  t-export-secret-info.in.json,
  t-export-secret-info.out.json,
  t-export.in.json,
  t-export.out.json,
  t-json.c,
  t-keylist-secret.in.json,
  t-keylist-secret.out.json,
  t-keylist.in.json,
  t-keylist.out.json,
  t-verify.in.json,
  t-verify.out.json,
  t-version.in.json,
  t-version.out.json: New.

--
Except for help and getmore there is now a test for each command.
2018-11-14 15:15:21 +01:00
Andre Heinecke
9a31fdcb11
tests,json: Add wildcard string matching
* tests/json/t-json.c (test_contains): When searching for "*" accept
every string.

--
This allows it to write tests that check for the existence of
a string value but don't care about the contents. E.g. for Data.
2018-11-14 14:57:40 +01:00
Andre Heinecke
e55e467d5f
tests,json: Skip tests for older GnuPG versions
* tests/json/t-json.c (main): Skip if version is not at least
2.2.0

--
In the past new tests often failed when a modern GPGME was
used with old GnuPG's.
This should avoid the hassle for packagers without the
requirement that we test against old versions.
2018-11-14 14:55:09 +01:00
Andre Heinecke
ca2e2b3d69
tests,json: Suffix .json to test pattern
* tests/json/t-config.in, tests/json/t-config.out: Renamed.
* t-json.c (run_test): Use new naming pattern.
2018-11-14 14:53:28 +01:00
Andre Heinecke
9933641cce
tests,json: Improve verbose mode and add verbose 2
* tests/json/t-json.c (main): Handle multiple verbose args.
(test-contains): Improve verbose output
2018-11-14 13:14:52 +01:00
Andre Heinecke
3e5684d99b
tests,json: Fix and improve t-json
* tests/json/t-json.c (run_test): Terminate argv array correctly.
(run_test): Note and handle empty response.
2018-11-14 13:05:36 +01:00
Andre Heinecke
0c31837766
tests: Add json testrunner
* configure.ac: Configure makefile.
* tests/Makefile.am: Run json tests if gpg tests are run.
* tests/json/t-json.c: New testrunner for json tests.
* tests/json/t-config.in, tests/json/t-config.out: First test.
--
The idea of this test runner is that it only looks for parts
in the output. This should allow it to write robust tests
that check for the basics in the output but don't fail when
the output is extended or slightly changed.
2018-11-14 11:51:08 +01:00