--- a/tests/hghave
+++ b/tests/hghave
@@ -1,6 +1,7 @@
#!/usr/bin/env python
"""Test the running system for features availability. Exit with zero
-if all features are there, non-zero otherwise.
+if all features are there, non-zero otherwise. If a feature name is
+prefixed with "no-", the absence of feature is tested.
"""
import optparse
import os
@@ -67,13 +68,19 @@ if __name__ == '__main__':
failures += 1
for feature in args:
+ negate = feature.startswith('no-')
+ if negate:
+ feature = feature[3:]
+
if feature not in checks:
error('hghave: unknown feature: ' + feature)
continue
check, desc = checks[feature]
- if not check():
+ if not negate and not check():
error('hghave: missing feature: ' + desc)
+ elif negate and check():
+ error('hghave: unexpected feature: ' + desc)
if failures != 0:
sys.exit(1)