diff tests/hghave.py @ 36707:7834927f0243

tests: add tests about diff quality These show the differences between bdiff and xdiff. Differential Revision: https://phab.mercurial-scm.org/D2604
author Jun Wu <quark@fb.com>
date Sat, 03 Mar 2018 12:39:15 -0800
parents dc11f257ad1d
children 1d06407d0ee9
line wrap: on
line diff
--- a/tests/hghave.py	Sat Mar 03 12:39:14 2018 -0800
+++ b/tests/hghave.py	Sat Mar 03 12:39:15 2018 -0800
@@ -708,3 +708,12 @@
         # libfuzzer is new in clang 6
         return int(mat.group(1)) > 5
     return False
+
+@check("xdiff", "xdiff algorithm")
+def has_xdiff():
+    try:
+        from mercurial import policy
+        bdiff = policy.importmod('bdiff')
+        return bdiff.xdiffblocks('', '') == [(0, 0, 0, 0)]
+    except (ImportError, AttributeError) as ex:
+        return False