##// END OF EJS Templates
tests: make test-commandserver.py output readable
Mads Kiilerich -
r15541:3aee6e26 default
parent child Browse files
Show More
@@ -26,6 +26,7 b' def readchannel(server):'
26 return channel, server.stdout.read(length)
26 return channel, server.stdout.read(length)
27
27
28 def runcommand(server, args, output=sys.stdout, error=sys.stderr, input=None):
28 def runcommand(server, args, output=sys.stdout, error=sys.stderr, input=None):
29 print ' runcommand', ' '.join(args)
29 server.stdin.write('runcommand\n')
30 server.stdin.write('runcommand\n')
30 writeblock(server, '\0'.join(args))
31 writeblock(server, '\0'.join(args))
31
32
@@ -52,6 +53,9 b' def runcommand(server, args, output=sys.'
52 return
53 return
53
54
54 def check(func, repopath=None):
55 def check(func, repopath=None):
56 print
57 print 'testing %s:' % func.__name__
58 print
55 server = connect(repopath)
59 server = connect(repopath)
56 try:
60 try:
57 return func(server)
61 return func(server)
@@ -1,6 +1,17 b''
1
2 testing hellomessage:
3
1 o, 'capabilities: getencoding runcommand\nencoding: ***'
4 o, 'capabilities: getencoding runcommand\nencoding: ***'
5 runcommand id
2 000000000000 tip
6 000000000000 tip
3 abort: unknown command unknowncommand
7 abort: unknown command unknowncommand
8
9 testing unknowncommand:
10
11
12 testing checkruncommand:
13
14 runcommand
4 Mercurial Distributed SCM
15 Mercurial Distributed SCM
5
16
6 basic commands:
17 basic commands:
@@ -24,44 +35,86 b' basic commands:'
24 update update working directory (or switch revisions)
35 update update working directory (or switch revisions)
25
36
26 use "hg help" for the full list of commands or "hg -v" for details
37 use "hg help" for the full list of commands or "hg -v" for details
38 runcommand id --quiet
27 000000000000
39 000000000000
40 runcommand id
28 000000000000 tip
41 000000000000 tip
42 runcommand id --config ui.quiet=True
29 000000000000
43 000000000000
44 runcommand id
30 000000000000 tip
45 000000000000 tip
46
47 testing inputeof:
48
31 server exit code = 1
49 server exit code = 1
50
51 testing serverinput:
52
53 runcommand import -
32 applying patch from stdin
54 applying patch from stdin
55 runcommand log
33 changeset: 0:eff892de26ec
56 changeset: 0:eff892de26ec
34 tag: tip
57 tag: tip
35 user: test
58 user: test
36 date: Thu Jan 01 00:00:00 1970 +0000
59 date: Thu Jan 01 00:00:00 1970 +0000
37 summary: 1
60 summary: 1
38
61
62
63 testing cwd:
64
65 runcommand --cwd foo st bar
39 ? bar
66 ? bar
67 runcommand st foo/bar
40 ? foo/bar
68 ? foo/bar
69
70 testing localhgrc:
71
72 runcommand showconfig
41 bundle.mainreporoot=$TESTTMP
73 bundle.mainreporoot=$TESTTMP
42 defaults.backout=-d "0 0"
74 defaults.backout=-d "0 0"
43 defaults.commit=-d "0 0"
75 defaults.commit=-d "0 0"
44 defaults.tag=-d "0 0"
76 defaults.tag=-d "0 0"
45 ui.slash=True
77 ui.slash=True
46 ui.foo=bar
78 ui.foo=bar
79 runcommand init foo
80 runcommand -R foo showconfig
47 bundle.mainreporoot=$TESTTMP/foo
81 bundle.mainreporoot=$TESTTMP/foo
48 defaults.backout=-d "0 0"
82 defaults.backout=-d "0 0"
49 defaults.commit=-d "0 0"
83 defaults.commit=-d "0 0"
50 defaults.tag=-d "0 0"
84 defaults.tag=-d "0 0"
51 ui.slash=True
85 ui.slash=True
86
87 testing hookoutput:
88
89 runcommand --config hooks.pre-identify=python:test-commandserver.hook id
52 hook talking
90 hook talking
53 now try to read something: 'some input'
91 now try to read something: 'some input'
54 eff892de26ec tip
92 eff892de26ec tip
93
94 testing outsidechanges:
95
96 runcommand tip
55 changeset: 1:d3a0a68be6de
97 changeset: 1:d3a0a68be6de
56 tag: tip
98 tag: tip
57 user: test
99 user: test
58 date: Thu Jan 01 00:00:00 1970 +0000
100 date: Thu Jan 01 00:00:00 1970 +0000
59 summary: 2
101 summary: 2
60
102
103
104 testing bookmarks:
105
106 runcommand bookmarks
61 no bookmarks set
107 no bookmarks set
108 runcommand bookmarks
62 bm1 1:d3a0a68be6de
109 bm1 1:d3a0a68be6de
63 bm2 1:d3a0a68be6de
110 bm2 1:d3a0a68be6de
111 runcommand bookmarks
64 * bm1 1:d3a0a68be6de
112 * bm1 1:d3a0a68be6de
65 bm2 1:d3a0a68be6de
113 bm2 1:d3a0a68be6de
66
114
115 testing tagscache:
116
117 runcommand id -t -r 0
118
119 runcommand id -t -r 0
67 foo
120 foo
General Comments 0
You need to be logged in to leave comments. Login now