869146b8b9fb

Test bookmark output.
[view raw] [browse files]
author Kevin Bullock <kbullock@ringworld.org>
date Fri, 31 Jul 2015 14:31:40 -0500
parents 1cb3af183d2f
children 5dc059aeb5f4
branches/tags (none)
files tests/test_bookmark.py tests/util.py

Changes

diff -r 1cb3af183d2f -r 869146b8b9fb tests/test_bookmark.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test_bookmark.py	Fri Jul 31 14:31:40 2015 -0500
@@ -0,0 +1,19 @@
+'''Test output of {bookmark}.'''
+
+from nose import *
+from util import *
+
+@with_setup(setup_sandbox, teardown_sandbox)
+def test_bookmark():
+    hg_bookmark('test')
+
+    output = prompt(fs='{bookmark}')
+    assert output == 'test'
+
+@with_setup(setup_sandbox, teardown_sandbox)
+def test_no_bookmark():
+    hg_bookmark('test')
+    hg_deactivate_bookmark()
+
+    output = prompt(fs='{bookmark}')
+    assert output == ''
diff -r 1cb3af183d2f -r 869146b8b9fb tests/util.py
--- a/tests/util.py	Mon Feb 10 14:14:04 2014 +0100
+++ b/tests/util.py	Fri Jul 31 14:31:40 2015 -0500
@@ -41,6 +41,12 @@
 def hg_branch(branch='test'):
     commands.branch(_ui, get_sandbox_repo(), branch)
 
+def hg_bookmark(bookmark='test'):
+    commands.bookmark(_ui, get_sandbox_repo(), bookmark)
+
+def hg_deactivate_bookmark():
+    commands.bookmark(_ui, get_sandbox_repo(), inactive=True)
+
 def hg_update(rev):
     opts = { 'rev': str(rev), }
     commands.update(_ui, get_sandbox_repo(), **opts)