# HG changeset patch # User Steve Losh # Date 1259352033 18000 # Node ID 6399fff665ffbfde04c4ab4c53d6e577003bd3d4 # Parent 72415625601754b9d4e3a29bdea3563b610a3dfb Add tests for {rev}. diff -r 724156256017 -r 6399fff665ff tests/test_rev.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test_rev.py Fri Nov 27 15:00:33 2009 -0500 @@ -0,0 +1,56 @@ +'''Test output of {node}.''' + +import os +from nose import * +from util import * + + +def _parent_rev(): + opts = { 'template': '{rev}', 'rev': '.', 'date': None, 'user': None } + + _ui = get_sandbox_ui() + _ui.pushbuffer() + commands.log(_ui, get_sandbox_repo(), **opts) + + return _ui.popbuffer() + + +@with_setup(setup_sandbox, teardown_sandbox) +def test_nullrev(): + output = prompt(fs='{rev}') + assert output == '' + + output = prompt(fs='{ at revision {rev}}') + assert output == '' + + +@with_setup(setup_sandbox, teardown_sandbox) +def test_rev(): + hg_commit() + + output = prompt(fs='{rev}') + assert output == _parent_rev() + + output = prompt(fs='{ at revision {rev}}') + assert output == ' at revision %s' % _parent_rev() + + hg_commit() + output = prompt(fs='{rev}') + assert output == _parent_rev() + + +@with_setup(setup_sandbox, teardown_sandbox) +def test_merge_filter(): + hg_commit('one.txt') + hg_commit('one.txt') + rev_to_merge = _parent_rev() + + hg_update(0) + hg_commit('two.txt') + hg_merge(1) + + output = prompt(fs='{rev|merge}') + assert output == rev_to_merge + + output = prompt(fs='{ merging with {rev|merge}}') + assert output == ' merging with %s' % rev_to_merge