Add test for reading format string from HGRC
author |
Oben Sonne <obensonne@googlemail.com> |
date |
Thu, 27 Feb 2014 14:39:40 +0100 |
parents |
046811b7cb2d
|
children |
003e92ae20da
|
branches/tags |
(none) |
files |
tests/test_hgrc.py |
Changes
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test_hgrc.py Thu Feb 27 14:39:40 2014 +0100
@@ -0,0 +1,23 @@
+'''Test evaluation of prompt template in HGRC.'''
+
+from nose import *
+from util import *
+
+
+@with_setup(setup_sandbox, teardown_sandbox)
+def test_hgrc():
+
+ with open(os.path.join(sandbox_path, '.hg', 'hgrc'), 'w') as fp:
+ fp.write('[prompt]\ntemplate =\n')
+
+ output = prompt(fs='{node}')
+ assert output == ''
+
+ with open(os.path.join(sandbox_path, '.hg', 'hgrc'), 'w') as fp:
+ fp.write('[prompt]\ntemplate = { at node {node}}\n')
+
+ output = prompt(fs='{node}')
+ assert output == ' at node 0000000000000000000000000000000000000000'
+
+ output = prompt(fs='')
+ assert output == ' at node 0000000000000000000000000000000000000000'