Mercurial > hg
comparison tests/test-removeemptydirs.t @ 47980:1941064d3713 stable
tests: make removeemptydirs more portable
The behavior of pwd change from one system (i.e. default shell/sh) from one
system to another so we use fuzzy matching for the output we do not care and we
use narrower command call to highlight what we are trying to test here.
Differential Revision: https://phab.mercurial-scm.org/D11449
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 17 Sep 2021 21:04:21 +0200 |
parents | 5f836c10ed3d |
children | 12efb17faee2 |
comparison
equal
deleted
inserted
replaced
47979:b84fe613de33 | 47980:1941064d3713 |
---|---|
1 Tests for experimental.removeemptydirs | 1 Tests for experimental.removeemptydirs |
2 | |
3 $ cat >> pwd.py << EOF | |
4 > import os | |
5 > try: | |
6 > print(os.getcwd()) | |
7 > except OSError: | |
8 > print("<directory is no longer accessible>") | |
9 > EOF | |
2 | 10 |
3 $ NO_RM=--config=experimental.removeemptydirs=0 | 11 $ NO_RM=--config=experimental.removeemptydirs=0 |
4 $ DO_RM=--config=experimental.removeemptydirs=1 | 12 $ DO_RM=--config=experimental.removeemptydirs=1 |
5 $ isdir() { if [ -d $1 ]; then echo yes; else echo no; fi } | 13 $ isdir() { if [ -d $1 ]; then echo yes; else echo no; fi } |
6 $ isfile() { if [ -f $1 ]; then echo yes; else echo no; fi } | 14 $ isfile() { if [ -f $1 ]; then echo yes; else echo no; fi } |
130 histedit_commands | 138 histedit_commands |
131 r0 | 139 r0 |
132 r1 | 140 r1 |
133 r2 | 141 r2 |
134 somedir | 142 somedir |
135 $ pwd | 143 #if windows |
144 $ "$PYTHON" "$TESTTMP/pwd.py" | |
136 $TESTTMP/hghistedit/somedir | 145 $TESTTMP/hghistedit/somedir |
146 #else | |
147 $ echo ${PWD} # no-pwd-check | |
148 $TESTTMP/hghistedit/somedir | |
149 $ "$PYTHON" "$TESTTMP/pwd.py" | |
150 <directory is no longer accessible> | |
151 #endif | |
137 $ ls -1 $TESTTMP/hghistedit/somedir | 152 $ ls -1 $TESTTMP/hghistedit/somedir |
138 foo | 153 foo |
139 $ ls -1 | 154 $ ls -1 |
140 foo (windows !) | 155 foo (windows !) |
141 | 156 |
142 Get out of the doomed directory | 157 Get out of the doomed directory |
143 | 158 |
144 $ cd $TESTTMP/hghistedit | 159 $ cd $TESTTMP/hghistedit |
160 chdir: error retrieving current directory: getcwd: cannot access parent directories: $ENOENT$ (?) | |
145 $ hg files --rev . | grep somedir/ | 161 $ hg files --rev . | grep somedir/ |
146 somedir/foo | 162 somedir/foo |
147 | 163 |
148 | 164 |
149 $ cat > histedit_commands <<EOF | 165 $ cat > histedit_commands <<EOF |