Mercurial > hg
comparison tests/test-progress.t @ 13141:6cfe17c19ba2
tests: add filtercr.py helper for progress tests
The two tests that used filtercr.py already used a slightly different
version, which explains why test-convert-svn-move.t changed after
switching to using $TESTDIR/filtercr.py.
author | Martin Geisler <mg@aragost.com> |
---|---|
date | Wed, 15 Dec 2010 16:29:46 +0100 |
parents | 05fffd665170 |
children | e9827c85c50b |
comparison
equal
deleted
inserted
replaced
13140:217ae7d5c8ee | 13141:6cfe17c19ba2 |
---|---|
21 > "loop": (loop, [('', 'total', '', 'override for total')], | 21 > "loop": (loop, [('', 'total', '', 'override for total')], |
22 > 'hg loop LOOPS'), | 22 > 'hg loop LOOPS'), |
23 > } | 23 > } |
24 > EOF | 24 > EOF |
25 | 25 |
26 $ cat > filtercr.py <<EOF | |
27 > import sys, re | |
28 > for line in sys.stdin: | |
29 > line = re.sub(r'\r+[^\n]', lambda m: '\n' + m.group()[-1:], line) | |
30 > sys.stdout.write(line) | |
31 > print | |
32 > EOF | |
33 | |
34 $ echo "[extensions]" >> $HGRCPATH | 26 $ echo "[extensions]" >> $HGRCPATH |
35 $ echo "progress=" >> $HGRCPATH | 27 $ echo "progress=" >> $HGRCPATH |
36 $ echo "loop=`pwd`/loop.py" >> $HGRCPATH | 28 $ echo "loop=`pwd`/loop.py" >> $HGRCPATH |
37 $ echo "[progress]" >> $HGRCPATH | 29 $ echo "[progress]" >> $HGRCPATH |
38 $ echo "assume-tty=1" >> $HGRCPATH | 30 $ echo "assume-tty=1" >> $HGRCPATH |
39 | 31 |
40 test default params, display nothing because of delay | 32 test default params, display nothing because of delay |
41 | 33 |
42 $ hg -y loop 3 2>&1 | python filtercr.py | 34 $ hg -y loop 3 2>&1 | $TESTDIR/filtercr.py |
43 | 35 |
44 $ echo "delay=0" >> $HGRCPATH | 36 $ echo "delay=0" >> $HGRCPATH |
45 $ echo "refresh=0" >> $HGRCPATH | 37 $ echo "refresh=0" >> $HGRCPATH |
46 | 38 |
47 test with delay=0, refresh=0 | 39 test with delay=0, refresh=0 |
48 | 40 |
49 $ hg -y loop 3 2>&1 | python filtercr.py | 41 $ hg -y loop 3 2>&1 | $TESTDIR/filtercr.py |
50 | 42 |
51 loop [ ] 0/3 | 43 loop [ ] 0/3 |
52 loop [=====================> ] 1/3 | 44 loop [=====================> ] 1/3 |
53 loop [============================================> ] 2/3 | 45 loop [============================================> ] 2/3 |
54 \r (esc) | 46 \r (esc) |
55 | 47 |
56 test refresh is taken in account | 48 test refresh is taken in account |
57 | 49 |
58 $ hg -y --config progress.refresh=100 loop 3 2>&1 | python filtercr.py | 50 $ hg -y --config progress.refresh=100 loop 3 2>&1 | $TESTDIR/filtercr.py |
59 | 51 |
60 | 52 |
61 test format options 1 | 53 test format options 1 |
62 | 54 |
63 $ hg -y --config 'progress.format=number topic item+2' loop 2 2>&1 | python filtercr.py | 55 $ hg -y --config 'progress.format=number topic item+2' loop 2 2>&1 \ |
56 > | $TESTDIR/filtercr.py | |
64 | 57 |
65 0/2 loop lo | 58 0/2 loop lo |
66 1/2 loop lo | 59 1/2 loop lo |
67 \r (esc) | 60 \r (esc) |
68 | 61 |
69 test format options 2 | 62 test format options 2 |
70 | 63 |
71 $ hg -y --config 'progress.format=number item-3 bar' loop 2 2>&1 | python filtercr.py | 64 $ hg -y --config 'progress.format=number item-3 bar' loop 2 2>&1 \ |
65 > | $TESTDIR/filtercr.py | |
72 | 66 |
73 0/2 p.0 [ ] | 67 0/2 p.0 [ ] |
74 1/2 p.1 [=================================> ] | 68 1/2 p.1 [=================================> ] |
75 \r (esc) | 69 \r (esc) |
76 | 70 |
77 test format options and indeterminate progress | 71 test format options and indeterminate progress |
78 | 72 |
79 $ hg -y --config 'progress.format=number item bar' loop -- -2 2>&1 | python filtercr.py | 73 $ hg -y --config 'progress.format=number item bar' loop -- -2 2>&1 \ |
74 > | $TESTDIR/filtercr.py | |
80 | 75 |
81 0 loop.0 [ <=> ] | 76 0 loop.0 [ <=> ] |
82 1 loop.1 [ <=> ] | 77 1 loop.1 [ <=> ] |
83 \r (esc) | 78 \r (esc) |
84 | 79 |
85 make sure things don't fall over if count > total | 80 make sure things don't fall over if count > total |
86 | 81 |
87 $ hg -y loop --total 4 6 2>&1 | python filtercr.py | 82 $ hg -y loop --total 4 6 2>&1 | $TESTDIR/filtercr.py |
88 | 83 |
89 loop [ ] 0/4 | 84 loop [ ] 0/4 |
90 loop [================> ] 1/4 | 85 loop [================> ] 1/4 |
91 loop [=================================> ] 2/4 | 86 loop [=================================> ] 2/4 |
92 loop [==================================================> ] 3/4 | 87 loop [==================================================> ] 3/4 |
94 loop [ <=> ] 5/4 | 89 loop [ <=> ] 5/4 |
95 \r (esc) | 90 \r (esc) |
96 | 91 |
97 test immediate progress completion | 92 test immediate progress completion |
98 | 93 |
99 $ hg -y loop 0 2>&1 | python filtercr.py | 94 $ hg -y loop 0 2>&1 | $TESTDIR/filtercr.py |
100 | 95 |