# HG changeset patch # User Oben Sonne # Date 1393508380 -3600 # Node ID 2e292ca8d7688a965488da61e0f7b8f55af1fbb9 # Parent 046811b7cb2daafabf55bf700dd69c3aac051443 Add test for reading format string from HGRC diff -r 046811b7cb2d -r 2e292ca8d768 tests/test_hgrc.py --- /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'