# HG changeset patch # User Adrian Buehlmann # Date 1339161065 -7200 # Node ID b0e8afdfa97032aba6ef96de53d856a1901a0c2c # Parent 4d95878712ad2e70adfa77d76357496819db26c0 tests/hghave: implement #if true / #if false For unconditionally testing / skipping a section. Useful for testing the test infrastructure in test-run-tests.t and for debugging/developing tests. diff -r 4d95878712ad -r b0e8afdfa970 tests/hghave --- a/tests/hghave Fri Jun 08 15:11:05 2012 +0200 +++ b/tests/hghave Fri Jun 08 15:11:05 2012 +0200 @@ -241,6 +241,8 @@ return os.getenv('MSYSTEM') checks = { + "true": (lambda: True, "yak shaving"), + "false": (lambda: False, "nail clipper"), "baz": (has_baz, "GNU Arch baz client"), "bzr": (has_bzr, "Canonical's Bazaar client"), "bzr114": (has_bzr114, "Canonical's Bazaar client >= 1.14"), diff -r 4d95878712ad -r b0e8afdfa970 tests/test-run-tests.t --- a/tests/test-run-tests.t Fri Jun 08 15:11:05 2012 +0200 +++ b/tests/test-run-tests.t Fri Jun 08 15:11:05 2012 +0200 @@ -52,9 +52,27 @@ $ echo 'foo (re)' foo (re) +testing hghave + + $ "$TESTDIR/hghave" true + $ "$TESTDIR/hghave" false + skipped: missing feature: nail clipper + [1] + $ "$TESTDIR/hghave" no-true + skipped: system supports yak shaving + [1] + $ "$TESTDIR/hghave" no-false + Conditional sections based on hghave: -#if fifo no-fifo +#if true + $ echo tested + tested +#else + $ echo skipped +#endif + +#if false $ echo skipped #else $ echo tested