Mercurial > hg-stable
changeset 12366:c01dc9087d9a
tests: drop a bunch of sed calls from unified tests
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Tue, 21 Sep 2010 16:44:13 -0500 |
parents | 22f3353bcc36 |
children | 3acd5f7ab9d0 |
files | contrib/check-code.py tests/test-archive.t tests/test-bisect.t tests/test-export.t tests/test-hgignore.t tests/test-hgrc.t tests/test-import.t tests/test-incoming-outgoing.t tests/test-mq-qdiff.t tests/test-pull.t tests/test-subrepo-svn.t tests/test-tags.t |
diffstat | 12 files changed, 102 insertions(+), 96 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/check-code.py Tue Sep 21 16:00:02 2010 -0500 +++ b/contrib/check-code.py Tue Sep 21 16:44:13 2010 -0500 @@ -72,6 +72,7 @@ uprefix = r"^ \$ " utestpats = [ + (uprefix + r'.*\|\s*sed', "use regex test output patterns instead of sed"), (uprefix + r'(true|exit 0)', "explicit zero exit unnecessary"), (uprefix + r'.*\$\?', "explicit exit code checks unnecessary"), (uprefix + r'.*\|\| echo.*(fail|error)',
--- a/tests/test-archive.t Tue Sep 21 16:00:02 2010 -0500 +++ b/tests/test-archive.t Tue Sep 21 16:44:13 2010 -0500 @@ -74,23 +74,23 @@ > % (os.environ['HGPORT'], node, archive)) > sys.stdout.write(f.read()) > EOF - $ python getarchive.py "$TIP" gz | gunzip | tar tf - 2>/dev/null | sed "s/$QTIP/TIP/" - test-archive-TIP/.hg_archival.txt - test-archive-TIP/bar - test-archive-TIP/baz/bletch - test-archive-TIP/foo - $ python getarchive.py "$TIP" bz2 | bunzip2 | tar tf - 2>/dev/null | sed "s/$QTIP/TIP/" - test-archive-TIP/.hg_archival.txt - test-archive-TIP/bar - test-archive-TIP/baz/bletch - test-archive-TIP/foo + $ python getarchive.py "$TIP" gz | gunzip | tar tf - 2>/dev/null + test-archive-2c0277f05ed4/.hg_archival.txt + test-archive-2c0277f05ed4/bar + test-archive-2c0277f05ed4/baz/bletch + test-archive-2c0277f05ed4/foo + $ python getarchive.py "$TIP" bz2 | bunzip2 | tar tf - 2>/dev/null + test-archive-2c0277f05ed4/.hg_archival.txt + test-archive-2c0277f05ed4/bar + test-archive-2c0277f05ed4/baz/bletch + test-archive-2c0277f05ed4/foo $ python getarchive.py "$TIP" zip > archive.zip - $ unzip -t archive.zip | sed "s/$QTIP/TIP/" + $ unzip -t archive.zip Archive: archive.zip - testing: test-archive-TIP/.hg_archival.txt OK - testing: test-archive-TIP/bar OK - testing: test-archive-TIP/baz/bletch OK - testing: test-archive-TIP/foo OK + testing: test-archive-2c0277f05ed4/.hg_archival.txt OK + testing: test-archive-2c0277f05ed4/bar OK + testing: test-archive-2c0277f05ed4/baz/bletch OK + testing: test-archive-2c0277f05ed4/foo OK No errors detected in compressed data of archive.zip. $ "$TESTDIR/killdaemons.py" @@ -109,11 +109,11 @@ test/foo $ hg archive -t tgz -p %b-%h test-%h.tar.gz - $ gzip -dc test-$QTIP.tar.gz | tar tf - 2>/dev/null | sed "s/$QTIP/TIP/" - test-TIP/.hg_archival.txt - test-TIP/bar - test-TIP/baz/bletch - test-TIP/foo + $ gzip -dc test-$QTIP.tar.gz | tar tf - 2>/dev/null + test-2c0277f05ed4/.hg_archival.txt + test-2c0277f05ed4/bar + test-2c0277f05ed4/baz/bletch + test-2c0277f05ed4/foo $ hg archive autodetected_test.tar $ tar tf autodetected_test.tar @@ -175,11 +175,11 @@ testing: test/foo OK No errors detected in compressed data of test.zip. - $ hg archive -t tar - | tar tf - 2>/dev/null | sed "s/$QTIP/TIP/" - test-TIP/.hg_archival.txt - test-TIP/bar - test-TIP/baz/bletch - test-TIP/foo + $ hg archive -t tar - | tar tf - 2>/dev/null + test-2c0277f05ed4/.hg_archival.txt + test-2c0277f05ed4/bar + test-2c0277f05ed4/baz/bletch + test-2c0277f05ed4/foo $ hg archive -r 0 -t tar rev-%r.tar $ if [ -f rev-0.tar ]; then
--- a/tests/test-bisect.t Tue Sep 21 16:00:02 2010 -0500 +++ b/tests/test-bisect.t Tue Sep 21 16:44:13 2010 -0500 @@ -277,6 +277,7 @@ $ hg bisect -g tip $ hg bisect -b tip abort: starting revisions are not directly related + [255] $ hg bisect -r $ hg bisect -g null @@ -349,6 +350,7 @@ $ hg bisect -r $ hg bisect abort: cannot bisect (no known good revisions) + [255] reproduce AssertionError, issue1445
--- a/tests/test-export.t Tue Sep 21 16:00:02 2010 -0500 +++ b/tests/test-export.t Tue Sep 21 16:44:13 2010 -0500 @@ -81,13 +81,13 @@ Exporting 4 changesets to a file: $ hg export -o export_internal 1 2 3 4 - $ grep HG export_internal | wc -l | sed -e 's/^ *//' - 4 + $ grep HG export_internal | wc -l + \s*4 Exporting 4 changesets to a file: - $ hg export 1 2 3 4 | grep HG | wc -l | sed -e 's/^ *//' - 4 + $ hg export 1 2 3 4 | grep HG | wc -l + \s*4 Exporting revision -2 to a file:
--- a/tests/test-hgignore.t Tue Sep 21 16:00:02 2010 -0500 +++ b/tests/test-hgignore.t Tue Sep 21 16:44:13 2010 -0500 @@ -43,8 +43,9 @@ ? syntax $ echo "*.o" > .hgignore - $ hg status 2>&1 | sed -e 's/abort: .*\.hgignore:/abort: .hgignore:/' - abort: .hgignore: invalid pattern (relre): *.o + $ hg status + abort: .*/.hgignore: invalid pattern \(relre\): \*.o + [255] $ echo ".*\.o" > .hgignore $ hg status @@ -86,8 +87,8 @@ ? syntax $ echo "syntax: invalid" > .hgignore - $ hg status 2>&1 | sed -e 's/.*\.hgignore:/.hgignore:/' - .hgignore: ignoring invalid syntax 'invalid' + $ hg status + .*/.hgignore: ignoring invalid syntax 'invalid' A dir/b.o ? .hgignore ? a.c
--- a/tests/test-hgrc.t Tue Sep 21 16:00:02 2010 -0500 +++ b/tests/test-hgrc.t Tue Sep 21 16:44:13 2010 -0500 @@ -1,6 +1,7 @@ $ echo "invalid" > $HGRCPATH - $ hg version 2>&1 | sed -e "s|$HGRCPATH|\$HGRCPATH|" - hg: parse error at $HGRCPATH:1: invalid + $ hg version + hg: parse error at .*/\.hgrc:1: invalid + [255] $ echo "" > $HGRCPATH issue1199: escaping @@ -11,22 +12,23 @@ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ p=`pwd` $ cd foobar - $ cat .hg/hgrc | sed -e "s:$p:...:" + $ cat .hg/hgrc [paths] - default = .../foo%bar - $ hg paths | sed -e "s:$p:...:" - default = .../foo%bar - $ hg showconfig | sed -e "s:$p:...:" - bundle.mainreporoot=.../foobar - paths.default=.../foo%bar + default = .*/foo%bar + $ hg paths + default = .*/foo%bar + $ hg showconfig + bundle.mainreporoot=.*/foobar + paths.default=.*/foo%bar $ cd .. issue1829: wrong indentation $ echo '[foo]' > $HGRCPATH $ echo ' x = y' >> $HGRCPATH - $ hg version 2>&1 | sed -e "s|$HGRCPATH|\$HGRCPATH|" - hg: parse error at $HGRCPATH:2: x = y + $ hg version + hg: parse error at .*/\.hgrc:2: x = y + [255] $ python -c "print '[foo]\nbar = a\n b\n c \n de\n fg \nbaz = bif cb \n'" \ > > $HGRCPATH @@ -37,8 +39,9 @@ $ FAKEPATH=/path/to/nowhere $ export FAKEPATH $ echo '%include $FAKEPATH/no-such-file' > $HGRCPATH - $ hg version 2>&1 | sed -e "s|$HGRCPATH|\$HGRCPATH|" - hg: parse error at $HGRCPATH:1: cannot include /path/to/nowhere/no-such-file (No such file or directory) + $ hg version + hg: parse error at .*/.hgrc:1: cannot include /path/to/nowhere/no-such-file \(No such file or directory\) + [255] $ unset FAKEPATH username expansion @@ -86,24 +89,24 @@ customized hgrc - $ hg showconfig | sed -e "s:$p:...:" - read config from: .../.hgrc - .../.hgrc:13: alias.log=log -g - .../.hgrc:11: defaults.identify=-n - .../.hgrc:2: ui.debug=true - .../.hgrc:3: ui.fallbackencoding=ASCII - .../.hgrc:4: ui.quiet=true - .../.hgrc:5: ui.slash=true - .../.hgrc:6: ui.traceback=true - .../.hgrc:7: ui.verbose=true - .../.hgrc:8: ui.style=~/.hgstyle - .../.hgrc:9: ui.logtemplate={node} + $ hg showconfig + read config from: .*/.hgrc + .*/.hgrc:13: alias.log=log -g + .*/.hgrc:11: defaults.identify=-n + .*/.hgrc:2: ui.debug=true + .*/.hgrc:3: ui.fallbackencoding=ASCII + .*/.hgrc:4: ui.quiet=true + .*/.hgrc:5: ui.slash=true + .*/.hgrc:6: ui.traceback=true + .*/.hgrc:7: ui.verbose=true + .*/.hgrc:8: ui.style=~/.hgstyle + .*/.hgrc:9: ui.logtemplate={node} plain hgrc $ HGPLAIN=; export HGPLAIN - $ hg showconfig --config ui.traceback=True --debug | sed -e "s:$p:...:" - read config from: .../.hgrc + $ hg showconfig --config ui.traceback=True --debug + read config from: .*/.hgrc none: ui.traceback=True none: ui.verbose=False none: ui.debug=True
--- a/tests/test-import.t Tue Sep 21 16:00:02 2010 -0500 +++ b/tests/test-import.t Tue Sep 21 16:44:13 2010 -0500 @@ -380,7 +380,8 @@ added 1 changesets with 2 changes to 2 files updating to branch default 2 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ hg --cwd a export tip | sed -e 's/d1\/d2\///' > tip.patch + $ hg --cwd a export tip > tmp + $ sed -e 's/d1\/d2\///' < tmp > tip.patch $ dir=`pwd` $ cd b/d1/d2 2>&1 > /dev/null $ hg import ../../../tip.patch
--- a/tests/test-incoming-outgoing.t Tue Sep 21 16:00:02 2010 -0500 +++ b/tests/test-incoming-outgoing.t Tue Sep 21 16:44:13 2010 -0500 @@ -20,8 +20,8 @@ http incoming - $ hg -R new incoming http://localhost:$HGPORT/ | sed -e "s,:$HGPORT/,:\$HGPORT/," - comparing with http://localhost:$HGPORT/ + $ hg -R new incoming http://localhost:$HGPORT/ + comparing with http://localhost:\d+/ changeset: 0:00a43fa82f62 user: test date: Thu Jan 01 00:00:00 1970 +0000 @@ -68,8 +68,8 @@ date: Thu Jan 01 00:00:00 1970 +0000 summary: 8 - $ hg -R new incoming -r 4 http://localhost:$HGPORT/ | sed -e "s,:$HGPORT/,:\$HGPORT/," - comparing with http://localhost:$HGPORT/ + $ hg -R new incoming -r 4 http://localhost:$HGPORT/ + comparing with http://localhost:\d+/ changeset: 0:00a43fa82f62 user: test date: Thu Jan 01 00:00:00 1970 +0000 @@ -221,8 +221,8 @@ test with --bundle - $ hg -R new incoming --bundle test.hg http://localhost:$HGPORT/ | sed -e "s,:$HGPORT/,:\$HGPORT/," - comparing with http://localhost:$HGPORT/ + $ hg -R new incoming --bundle test.hg http://localhost:$HGPORT/ + comparing with http://localhost:.*/ changeset: 0:00a43fa82f62 user: test date: Thu Jan 01 00:00:00 1970 +0000 @@ -419,8 +419,8 @@ date: Thu Jan 01 00:00:00 1970 +0000 summary: 11 - $ hg -R test-dev outgoing http://localhost:$HGPORT/ | sed -e "s,:$HGPORT/,:\$HGPORT/," - comparing with http://localhost:$HGPORT/ + $ hg -R test-dev outgoing http://localhost:$HGPORT/ + comparing with http://localhost:.*/ searching for changes changeset: 9:d89d4abea5bc user: test @@ -448,8 +448,8 @@ date: Thu Jan 01 00:00:00 1970 +0000 summary: 13 - $ hg -R test-dev outgoing -r 11 http://localhost:$HGPORT/ | sed -e "s,:$HGPORT/,:\$HGPORT/," - comparing with http://localhost:$HGPORT/ + $ hg -R test-dev outgoing -r 11 http://localhost:$HGPORT/ + comparing with http://localhost:.*/ searching for changes changeset: 9:d89d4abea5bc user: test
--- a/tests/test-mq-qdiff.t Tue Sep 21 16:00:02 2010 -0500 +++ b/tests/test-mq-qdiff.t Tue Sep 21 16:44:13 2010 -0500 @@ -17,10 +17,10 @@ qdiff: - $ hg qdiff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" + $ hg qdiff diff -r d20a80d4def3 base --- a/base Thu Jan 01 00:00:00 1970 +0000 - +++ b/base + \+\+\+ b/base.* @@ -1,1 +1,1 @@ -base +patched
--- a/tests/test-pull.t Tue Sep 21 16:00:02 2010 -0500 +++ b/tests/test-pull.t Tue Sep 21 16:44:13 2010 -0500 @@ -18,7 +18,7 @@ $ cat hg.pid >> $DAEMON_PIDS $ cd .. - $ hg clone --pull http://foo:bar@localhost:$HGPORT/ copy | sed -e "s,:$HGPORT/,:\$HGPORT/," + $ hg clone --pull http://foo:bar@localhost:$HGPORT/ copy requesting all changes adding changesets adding manifests @@ -43,13 +43,13 @@ $ hg manifest --debug 2ed2a3912a0b24502043eae84ee4b279c18b90dd 644 foo - $ hg pull | sed -e "s,:$HGPORT/,:\$HGPORT/," - pulling from http://foo:***@localhost:$HGPORT/ + $ hg pull + pulling from http://foo:\*\*\*@localhost:.*/ searching for changes no changes found - $ hg rollback --dry-run --verbose | sed -e "s,:$HGPORT/,:\$HGPORT/," - rolling back to revision -1 (undo pull: http://foo:***@localhost:$HGPORT/) + $ hg rollback --dry-run --verbose + rolling back to revision -1 \(undo pull: http://foo:\*\*\*@localhost:.*/\) Issue 622:
--- a/tests/test-subrepo-svn.t Tue Sep 21 16:00:02 2010 -0500 +++ b/tests/test-subrepo-svn.t Tue Sep 21 16:44:13 2010 -0500 @@ -5,15 +5,12 @@ > tr '\\' / > } - $ escapedwd=`pwd | fix_path` - SVN wants all paths to start with a slash. Unfortunately, Windows ones don't. Handle that. + $ escapedwd=`pwd | fix_path` $ expr "$escapedwd" : / > /dev/null || escapedwd="/$escapedwd" $ escapedwd=`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$escapedwd"` - $ filterpath="s|$escapedwd|/root|" - $ filteroutofdate='s/ in transaction.*/ is out of date/;s/Out of date: /File /' create subversion repo @@ -74,19 +71,18 @@ debugsub - $ hg debugsub | sed "$filterpath" + $ hg debugsub path s - source file:///root/svn-repo/src + source file:///.*/svn-repo/src revision 2 change file in svn and hg, commit $ echo a >> a $ echo alpha >> s/alpha - $ hg commit -m 'Message!' \ - > | sed 's:Sending.*s/alpha:Sending s/alpha:g' + $ hg commit -m 'Message!' committing subrepository s - Sending s/alpha + Sending.*s/alpha Transmitting file data . Committed revision 3. @@ -94,9 +90,9 @@ External at revision 1. At revision 3. - $ hg debugsub | sed "$filterpath" + $ hg debugsub path s - source file:///root/svn-repo/src + source file:///.*/svn-repo/src revision 3 $ echo a > s/a @@ -128,20 +124,22 @@ this commit from hg will fail $ echo zzz >> s/alpha - $ hg ci -m 'amend alpha from hg' 2>&1 | sed "$filteroutofdate" + $ hg ci -m 'amend alpha from hg' committing subrepository s abort: svn: Commit failed (details follow): - svn: File '/src/alpha' is out of date + svn: (Out of date)?.*/src/alpha.*(is out of date)? + [255] $ svn revert -q s/alpha this commit fails because of meta changes $ svn propset svn:mime-type 'text/html' s/alpha property 'svn:mime-type' set on 's/alpha' - $ hg ci -m 'amend alpha from hg' 2>&1 | sed "$filteroutofdate" + $ hg ci -m 'amend alpha from hg' committing subrepository s abort: svn: Commit failed (details follow): - svn: File '/src/alpha' is out of date + svn: (Out of date)?.*/src/alpha.*(is out of date)? + [255] $ svn revert -q s/alpha this commit fails because of externals changes @@ -192,9 +190,9 @@ debugsub in clone - $ hg debugsub | sed "$filterpath" + $ hg debugsub path s - source file:///root/svn-repo/src + source file:///.*/svn-repo/src revision 3 verify subrepo is contained within the repo directory
--- a/tests/test-tags.t Tue Sep 21 16:00:02 2010 -0500 +++ b/tests/test-tags.t Tue Sep 21 16:44:13 2010 -0500 @@ -123,7 +123,7 @@ $ echo "spam" >> .hgtags $ echo >> .hgtags $ echo "foo bar" >> .hgtags - $ echo "$T invalid" | sed "s/..../a5a5/" >> .hg/localtags + $ echo "a5a5 invalid" >> .hg/localtags $ echo "committing .hgtags:" committing .hgtags: $ cat .hgtags