diff options
author | Jim Meyering <meyering@redhat.com> | 2010-11-14 11:05:05 +0100 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2010-11-17 20:48:57 +0100 |
commit | f38becab02472e6872048a1951b249b2a3c054df (patch) | |
tree | e5b531384b55abae8b1829ada892891bfee58fe3 /tests/ln | |
parent | 30b74dfff16240ea0e4a4c5b705f1e9631e5d0a7 (diff) | |
download | coreutils-f38becab02472e6872048a1951b249b2a3c054df.tar.xz |
tests: convert first batch of tests from test-lib.sh to init.sh
Initially, I did this,
git grep -l srcdir/test-lib.sh|xargs perl -p0i -e '~180-byte script'
but that line would have been much longer than the maximum permitted
by coreutils' commit hook, and wasn't readable besides, so here's a
more readable version:
lhs=$(printf '%s\\n' \
'if test "$VERBOSE" = yes; then' \
' set -x' \
' touch --version' \
'fi' \
'' \
'. $srcdir/test-lib.sh' \
| sed 's/\$/\\\$/g;s/touch/(\\w+)/')
rhs=$(printf '%s\\n' \
'. "${srcdir=.}/init.sh"; path_prepend_ ../src' \
'test "$VERBOSE" = yes && FIXME --version' \
| sed 's/\$/\\\$/g;s/FIXME/\$1/')
git grep -l srcdir/test-lib.sh|xargs perl -p0i -e "s,$lhs,$rhs,"
Diffstat (limited to 'tests/ln')
-rwxr-xr-x | tests/ln/backup-1 | 8 | ||||
-rwxr-xr-x | tests/ln/hard-backup | 8 | ||||
-rwxr-xr-x | tests/ln/hard-to-sym | 8 | ||||
-rwxr-xr-x | tests/ln/misc | 8 | ||||
-rwxr-xr-x | tests/ln/slash-decorated-nonexistent-dest | 8 | ||||
-rwxr-xr-x | tests/ln/target-1 | 8 |
6 files changed, 12 insertions, 36 deletions
diff --git a/tests/ln/backup-1 b/tests/ln/backup-1 index 83d7e629b..f07ba9493 100755 --- a/tests/ln/backup-1 +++ b/tests/ln/backup-1 @@ -19,12 +19,8 @@ # Based on a problem report from Jamie Lokier. -if test "$VERBOSE" = yes; then - set -x - ln --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && ln --version touch a b || framework_failure diff --git a/tests/ln/hard-backup b/tests/ln/hard-backup index 6dfce5163..3b3f6ec71 100755 --- a/tests/ln/hard-backup +++ b/tests/ln/hard-backup @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - ln --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && ln --version touch f || framework_failure diff --git a/tests/ln/hard-to-sym b/tests/ln/hard-to-sym index ac74bb97d..a78b738ad 100755 --- a/tests/ln/hard-to-sym +++ b/tests/ln/hard-to-sym @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - ln --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && ln --version # =================================================== diff --git a/tests/ln/misc b/tests/ln/misc index 362bf354c..de03890f4 100755 --- a/tests/ln/misc +++ b/tests/ln/misc @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - ln --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && ln --version t=tln-symlink d=tln-subdir diff --git a/tests/ln/slash-decorated-nonexistent-dest b/tests/ln/slash-decorated-nonexistent-dest index f7d51e8bb..1020da270 100755 --- a/tests/ln/slash-decorated-nonexistent-dest +++ b/tests/ln/slash-decorated-nonexistent-dest @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if test "$VERBOSE" = yes; then - set -x - ln --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && ln --version touch f || framework_failure diff --git a/tests/ln/target-1 b/tests/ln/target-1 index 3865e2cde..1f1ebc2d5 100755 --- a/tests/ln/target-1 +++ b/tests/ln/target-1 @@ -21,12 +21,8 @@ # ln: `d/.': cannot overwrite directory # Based on a test case from Dmitry V. Levin. -if test "$VERBOSE" = yes; then - set -x - ln --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && ln --version mkdir d || framework_failure ln -s --target-dir=d ../f || fail=1 |