-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make remove-duplicates behaviour reproducible and add test
- Loading branch information
1 parent
7faba0c
commit f0ea524
Showing
4 changed files
with
46 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
%REMOVE-DUPLICATES(1) User Manuals | ||
%Samuel Tardieu <[email protected]> | ||
%November 12, 2016 | ||
%January 5, 2019 | ||
|
||
# NAME | ||
|
||
|
@@ -13,16 +13,15 @@ remove-duplicate [*-f*] | |
# DESCRIPTION | ||
|
||
Removes duplicates of the same file in the current directory if *-f* | ||
is given. If *-f* is not given, duplicate will be identified twice | ||
(once in every direction). | ||
is given. If *-f* is not given, duplicates will be identified. | ||
|
||
# OPTIONS | ||
|
||
-f | ||
|
||
# COPYRIGHT | ||
|
||
Copyright (c) 2004-2016 Samuel Tardieu <[email protected]>. | ||
Copyright (c) 2004-2019 Samuel Tardieu <[email protected]>. | ||
This is free software; see the source for copying conditions. There is | ||
NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR | ||
PURPOSE. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#! /bin/sh | ||
# | ||
|
||
topsrcdir=$(cd $(dirname $0)/.. && pwd) | ||
REMOVE_DUPLICATES="$topsrcdir/scripts/remove-duplicates" | ||
trap "rm -rf $PWD/$0.dir" INT QUIT TERM EXIT | ||
mkdir "$0.dir" | ||
cd "$0.dir" | ||
|
||
echo foo > foo1.txt | ||
echo foo > foo2.txt | ||
echo foo > foo3.txt | ||
echo foo > foo4.txt | ||
echo bar > bar1.txt | ||
echo bar > bar2.txt | ||
echo baz > baz1.txt | ||
echo zab > baz2.txt | ||
|
||
[ $("$REMOVE_DUPLICATES" -f | wc -l) = 4 ] || exit 1 | ||
|
||
[ $(ls foo?.txt | wc -l) = 1 ] || exit 2 | ||
|
||
[ -f foo1.txt ] || exit 3 | ||
|
||
[ $(ls bar?.txt | wc -l) = 1 ] || exit 4 | ||
|
||
[ -f bar1.txt ] || exit 5 | ||
|
||
[ $(ls baz?.txt | wc -l) = 2 ] || exit 6 |