annotate tests/test-dispatch.py @ 5383:7cdc896fdcd5

run-tests.py: reorder options alphabetically.
author Bryan O'Sullivan <bos@serpentine.com>
date Fri, 05 Oct 2007 09:30:02 -0700
parents 18a9fbb5cd78
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5147
f3f033def181 Added test for commands.dispatch (especially 88803a69b24)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
1 import os
5185
18a9fbb5cd78 dispatch: move command dispatching into its own module
Matt Mackall <mpm@selenic.com>
parents: 5147
diff changeset
2 from mercurial import dispatch
5147
f3f033def181 Added test for commands.dispatch (especially 88803a69b24)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
3
5185
18a9fbb5cd78 dispatch: move command dispatching into its own module
Matt Mackall <mpm@selenic.com>
parents: 5147
diff changeset
4 def testdispatch(cmd):
18a9fbb5cd78 dispatch: move command dispatching into its own module
Matt Mackall <mpm@selenic.com>
parents: 5147
diff changeset
5 """Simple wrapper around dispatch.dispatch()
5147
f3f033def181 Added test for commands.dispatch (especially 88803a69b24)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
6
f3f033def181 Added test for commands.dispatch (especially 88803a69b24)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
7 Prints command and result value, but does not handle quoting.
f3f033def181 Added test for commands.dispatch (especially 88803a69b24)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
8 """
f3f033def181 Added test for commands.dispatch (especially 88803a69b24)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
9 print "running: %s" % (cmd,)
5185
18a9fbb5cd78 dispatch: move command dispatching into its own module
Matt Mackall <mpm@selenic.com>
parents: 5147
diff changeset
10 result = dispatch.dispatch(cmd.split())
5147
f3f033def181 Added test for commands.dispatch (especially 88803a69b24)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
11 print "result: %r" % (result,)
f3f033def181 Added test for commands.dispatch (especially 88803a69b24)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
12
f3f033def181 Added test for commands.dispatch (especially 88803a69b24)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
13
5185
18a9fbb5cd78 dispatch: move command dispatching into its own module
Matt Mackall <mpm@selenic.com>
parents: 5147
diff changeset
14 testdispatch("init test1")
5147
f3f033def181 Added test for commands.dispatch (especially 88803a69b24)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
15 os.chdir('test1')
f3f033def181 Added test for commands.dispatch (especially 88803a69b24)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
16
f3f033def181 Added test for commands.dispatch (especially 88803a69b24)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
17 # create file 'foo', add and commit
f3f033def181 Added test for commands.dispatch (especially 88803a69b24)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
18 f = file('foo', 'wb')
f3f033def181 Added test for commands.dispatch (especially 88803a69b24)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
19 f.write('foo\n')
f3f033def181 Added test for commands.dispatch (especially 88803a69b24)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
20 f.close()
5185
18a9fbb5cd78 dispatch: move command dispatching into its own module
Matt Mackall <mpm@selenic.com>
parents: 5147
diff changeset
21 testdispatch("add foo")
18a9fbb5cd78 dispatch: move command dispatching into its own module
Matt Mackall <mpm@selenic.com>
parents: 5147
diff changeset
22 testdispatch("commit -m commit1 -d 2000-01-01 foo")
5147
f3f033def181 Added test for commands.dispatch (especially 88803a69b24)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
23
f3f033def181 Added test for commands.dispatch (especially 88803a69b24)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
24 # append to file 'foo' and commit
f3f033def181 Added test for commands.dispatch (especially 88803a69b24)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
25 f = file('foo', 'ab')
f3f033def181 Added test for commands.dispatch (especially 88803a69b24)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
26 f.write('bar\n')
f3f033def181 Added test for commands.dispatch (especially 88803a69b24)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
27 f.close()
5185
18a9fbb5cd78 dispatch: move command dispatching into its own module
Matt Mackall <mpm@selenic.com>
parents: 5147
diff changeset
28 testdispatch("commit -m commit2 -d 2000-01-02 foo")
5147
f3f033def181 Added test for commands.dispatch (especially 88803a69b24)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
29
f3f033def181 Added test for commands.dispatch (especially 88803a69b24)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
30 # check 88803a69b24 (fancyopts modified command table)
5185
18a9fbb5cd78 dispatch: move command dispatching into its own module
Matt Mackall <mpm@selenic.com>
parents: 5147
diff changeset
31 testdispatch("log -r 0")
18a9fbb5cd78 dispatch: move command dispatching into its own module
Matt Mackall <mpm@selenic.com>
parents: 5147
diff changeset
32 testdispatch("log -r tip")