tests/test_hgrc.py @ ae33e6b815ce

py3/unicode: adapt cmdtable entries to bytestrings
author David Champion <dgc@bikeshed.us>
date Thu, 30 Jul 2020 14:47:16 -0700
parents 003e92ae20da
children (none)
'''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 = foo\n')

    output = prompt(fs='')
    assert output == 'foo'

    output = prompt(fs='bar')
    assert output == 'bar'  # command line overwrites hgrc

    with open(os.path.join(sandbox_path, '.hg', 'hgrc'), 'w') as fp:
        fp.write('[prompt]\ntemplate = { at node {node}}\n')

    output = prompt(fs='')
    assert output == ' at node 0000000000000000000000000000000000000000'