view tests/test-hgweb @ 9857:24bc6e414610

diff: change --inverse to --reverse This fixes an incompatibility with patch(1), which also uses --reverse for reversed diffs. The --inverse flag was added in 3f522d2fa633. That name was chosen over --reverse since it was thought that --reverse would make --rev ambiguous. It turns out that both flags can co-exist, with the cost that --rev can no longer be shortened to --r and --re. Since one can always use the short -r option, this is not a real problem.
author Martin Geisler <mg@lazybytes.net>
date Sat, 14 Nov 2009 14:21:53 +0100
parents d3dbdca92458
children 1121af239761
line wrap: on
line source

#!/bin/sh
# Some tests for hgweb. Tests static files, plain files and different 404's.

hg init test
cd test
mkdir da
echo foo > da/foo
echo foo > foo
hg ci -Ambase

hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
cat hg.pid >> $DAEMON_PIDS

echo % manifest
("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/?style=raw')
("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/da?style=raw')

echo % plain file
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/foo?style=raw'

echo % should give a 404 - static file that does not exist
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/static/bogus'

echo % should give a 404 - bad revision
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/spam/foo?style=raw'

echo % should give a 400 - bad command
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/foo?cmd=spam&style=raw' | sed 's/400.*/400/'

echo % should give a 404 - file does not exist
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/bork?style=raw'
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/bork'
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/diff/tip/bork?style=raw'

echo % try bad style
("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/?style=foobar')

echo % stop and restart
"$TESTDIR/killdaemons.py"
hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log
cat hg.pid >> $DAEMON_PIDS
# Test the access/error files are opened in append mode
python -c "print len(file('access.log').readlines()), 'log lines written'"

echo % static file
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/static/style-gitweb.css'

echo % errors
cat errors.log