Commits

guillermooo committed 8bb0007

add test

Comments (0)

Files changed (4)

tests/__init__.py

Empty file added.
+def packages_path():
+    return 'XXX'

tests/sublime_plugin.py

+class Plugin(object):
+    pass
+
+
+class TextCommand(Plugin):
+    pass
+
+
+class WindowCommand(Plugin):
+    pass
+
+
+class EventListener(Plugin):
+    pass

tests/test_sublime_hg.py

+import sys
+import os
+
+import mock
+
+sys.path.insert(0, os.path.dirname(__file__))
+
+
+from sublime_hg import find_hg_root
+
+
+def test_ThatHgRootIsFoundCorrectly():
+    paths = (
+        r'C:\No\Luck\Here',
+        r'C:\Sometimes\You\Find\What\You\Are\Looking\For',
+        r'C:\Come\Get\Some\If\You\Dare',
+    ) 
+    old_exists = os.path.exists
+    os.path.exists = lambda path: path.endswith('Some\.hg')
+    results = [find_hg_root(x) for x in paths]
+    os.path.exists = old_exists
+    assert results == [None, None, 'C:\\Come\\Get\\Some']
+