Mercurial > hgrepos > DevTools > mercurial-extensions
changeset 262:71d8d1200e19
Prepare some of the very basics of unit-tests of the "timestamps" extension.
Uses the "run-tests.py" infrastructure as given in Mercurial's source.
The source code of Mercurial is required therefore.
| author | Franz Glasner <hg@dom66.de> |
|---|---|
| date | Fri, 04 Jan 2019 00:56:03 +0100 |
| parents | a16b86dfaf62 |
| children | 17df665bb309 |
| files | .hgignore tests/setup-timestamps.sh tests/test-info.t tests/test-timestamps.t |
| diffstat | 4 files changed, 58 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgignore Thu Jan 03 23:19:09 2019 +0100 +++ b/.hgignore Fri Jan 04 00:56:03 2019 +0100 @@ -2,3 +2,5 @@ *.pyc *.pyo +tests/.testtimes +_tmp/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/setup-timestamps.sh Fri Jan 04 00:56:03 2019 +0100 @@ -0,0 +1,30 @@ +#!/bin/sh +# +# Prepare a "canonical" repository for testing the timestamps extension +# + +hg init "$1" +cd "$1" +cat >.hgtimestamps <<EOF +[patterns] +files/** = +EOF +cat >>$HGRCPATH <<EOF +[extensions] +timestamps=$TESTDIR/../extensions/timestamps.py +EOF +hg add .hgtimestamps +hg ci -m 'Activate timestamps' +echo Check that .hgtimestamps.db is created and included automatically +hg manifest +# tracked directory +mkdir files +touch -d 2017-12-01T01:02:03Z files/test1.txt +hg add files/test1.txt +# untracked directory +mkdir untracked-directory +touch -d 2017-12-01T01:02:03 untracked-directory/untracked.txt +hg add untracked-directory/untracked.txt +hg ci -m 'Add a tracked and untracked file' +echo Check the content of .hgtimestamps.db +cat .hgtimestamps.db
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-info.t Fri Jan 04 00:56:03 2019 +0100 @@ -0,0 +1,16 @@ +The first test comment + + $ echo $HGRCPATH + ABC + $ cat $HGRCPATH + $ echo $TERM + TEST + $ echo PWD: `pwd` + $ echo TESTDIR: $TESTDIR + $ echo TESTTMP: $TESTTMP + $ ls -al $TESTTMP + $ ls -al $TESTTMP/.. + +Print the configuration + + $ hg showconfig
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-timestamps.t Fri Jan 04 00:56:03 2019 +0100 @@ -0,0 +1,10 @@ +Setup + + $ . $TESTDIR/setup-timestamps.sh ts1 + Check that .hgtimestamps.db is created and included automatically + .hgtimestamps + .hgtimestamps.db + Check the content of .hgtimestamps.db + version=1 + encoding=binary + files/test1.txt,2017-12-01T01:02:03Z
