diff options
-rw-r--r-- | CONTRIBUTING.md | 3 | ||||
-rwxr-xr-x | bin/lsrc.in | 4 | ||||
-rwxr-xr-x | bin/rcup.in | 4 | ||||
-rw-r--r-- | share/rcm.sh.in | 2 | ||||
-rw-r--r-- | test/helper.sh | 17 |
5 files changed, 10 insertions, 20 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 59d240d..31eb49b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -57,6 +57,9 @@ The test suite uses [cram][]. It is an integration suite, meaning the programs are exercised from the outside and assertions are made only on their output or effects. +The test suite requires Perl with the `Cwd` module. It expects to find Perl as +`perl` in `$PATH`. + All tests can be run like so: $ make check diff --git a/bin/lsrc.in b/bin/lsrc.in index 47ae889..fcf5fbe 100755 --- a/bin/lsrc.in +++ b/bin/lsrc.in @@ -118,7 +118,7 @@ show_file() { output="$output:$sigil" fi - if echo "$DEST_STACK:" | grep -vq ":$dest_file:"; then + if echo "$DEST_STACK:" | grep -v ":$dest_file:" >/dev/null; then DEST_STACK="$DEST_STACK:$dest_file" $PRINT "$output" else @@ -167,7 +167,7 @@ dotfiles_dir_excludes() { $DEBUG " with excludes: $excludes" for exclude in $excludes; do - if echo "$exclude" | grep -q ':'; then + if echo "$exclude" | grep ':' >/dev/null; then dotfiles_dir_pat="$(echo "$exclude" | sed 's/:.*//')" file_glob="$(echo "$exclude" | sed 's/.*://')" diff --git a/bin/rcup.in b/bin/rcup.in index f818258..bdae664 100755 --- a/bin/rcup.in +++ b/bin/rcup.in @@ -123,11 +123,11 @@ replace_file() { } is_nested() { - echo "$1" | sed "s:$DEST_DIR/::" | grep -q '/' + echo "$1" | sed "s:$DEST_DIR/::" | grep '/' >/dev/null } is_identical() { - diff -q -s "$1" "$2" > /dev/null + diff -c "$1" "$2" > /dev/null 2>&1 } handle_dir() { diff --git a/share/rcm.sh.in b/share/rcm.sh.in index 2ce68d4..d8fc19e 100644 --- a/share/rcm.sh.in +++ b/share/rcm.sh.in @@ -51,7 +51,7 @@ echo_stderr() { } is_relative() { - echo "$1" | grep -vq '^/' + echo "$1" | grep -v '^/' >/dev/null } version() { diff --git a/test/helper.sh b/test/helper.sh index d26749c..5016cf8 100644 --- a/test/helper.sh +++ b/test/helper.sh @@ -35,21 +35,8 @@ refute() { resolved_path() { local original_path="$1" - local actual_path="$original_path" - local actual_basename="$(basename "$original_path")" - - cd "$(dirname "$original_path")" - - while [ -L "$actual_basename" ]; do - actual_path="$(readlink "$actual_basename")" - actual_basename="$(basename "$actual_path")" - - cd "$(dirname "$actual_path")" - done - - local current_directory="$(pwd -P)" - - printf "%s/%s\n" "$current_directory" "$actual_basename" + perl -e \ + "use Cwd realpath; print realpath(\"$original_path\") . \"\\n\";" } assert_linked() { |