diff options
author | Julian Rex <julian.rex@mapbox.com> | 2018-05-03 20:34:56 -0400 |
---|---|---|
committer | Julian Rex <julian.rex@mapbox.com> | 2018-05-17 17:01:13 -0400 |
commit | 9a466ecd0b55789b24446ec1f897be213344e303 (patch) | |
tree | e3bd01e828f5bf881f07a75e7e0ebda1ce8db72c /platform/darwin | |
parent | 81bd7673d2b0c95bdb8970397a3a3e1a5e734b18 (diff) | |
download | qtlocation-mapboxgl-upstream/jrex-pending-test-macro.tar.gz |
Moved utility header into Darwinupstream/jrex-pending-test-macro
Diffstat (limited to 'platform/darwin')
-rw-r--r-- | platform/darwin/test/MGLTestUtility.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/platform/darwin/test/MGLTestUtility.h b/platform/darwin/test/MGLTestUtility.h new file mode 100644 index 0000000000..2e02e4f9de --- /dev/null +++ b/platform/darwin/test/MGLTestUtility.h @@ -0,0 +1,27 @@ + +/** + MGL_CHECK_IF_PENDING_TEST_SHOULD_RUN() + + Include this macro at the top of a "pending" test - one that would normally fail, + but you want to include is as a compile-time test or as a reminder. + + This will output the included warning in the test log, which `xcpretty` will detect. + This allows such pending tests to be identified in CI logs. + + If you provide `MAPBOX_RUN_PENDING_TESTS` as an environment variable ALL pending + tests will run. + + In addition, it's a good idea to append `PENDING` to the test method name, as this + will also be picked up by xcpretty. PENDING tests will be distinguished by a `⧖` + and `[PENDING]` + */ +#define MGL_CHECK_IF_PENDING_TEST_SHOULD_RUN() \ + /* By default, skip pending tests. Otherwise check environment for MAPBOX_RUN_PENDING_TESTS */ \ + { \ + NSString *runPendingTests = [[NSProcessInfo processInfo] environment][@"MAPBOX_RUN_PENDING_TESTS"]; \ + if (![runPendingTests boolValue]) { \ + /* The following warning will be picked up by xcpretty */ \ + printf("warning: '%s' is a pending test - skipping\n", __PRETTY_FUNCTION__); \ + return; \ + } \ + } |