D1816: tests: make #testcase available as env var in test
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Fri Jan 5 16:05:53 EST 2018
martinvonz updated this revision to Diff 4716.
martinvonz marked an inline comment as done.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D1816?vs=4715&id=4716
REVISION DETAIL
https://phab.mercurial-scm.org/D1816
AFFECTED FILES
tests/run-tests.py
tests/test-run-tests.t
CHANGE DETAILS
diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t
--- a/tests/test-run-tests.t
+++ b/tests/test-run-tests.t
@@ -1533,6 +1533,26 @@
python hash seed: * (glob)
[1]
+Test TESTCASE variable
+
+ $ cat > test-cases-ab.t <<'EOF'
+ > $ dostuff() {
+ > > echo "In case $TESTCASE"
+ > > }
+ > #testcases A B
+ > #if A
+ > $ dostuff
+ > In case A
+ > #endif
+ > #if B
+ > $ dostuff
+ > In case B
+ > #endif
+ > EOF
+ $ rt test-cases-ab.t
+ ..
+ # Ran 2 tests, 0 skipped, 0 failed.
+
Test automatic pattern replacement
$ cat << EOF >> common-pattern.py
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1334,6 +1334,8 @@
script.append(b'alias hg="%s"\n' % self._hgcommand)
if os.getenv('MSYSTEM'):
script.append(b'alias pwd="pwd -W"\n')
+ if self._case:
+ script.append(b'TESTCASE=%s\n' % shellquote(self._case))
n = 0
for n, l in enumerate(lines):
To: martinvonz, #hg-reviewers, quark
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list