summaryrefslogtreecommitdiff
path: root/test/util/pacsorttest.sh
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2013-01-19 12:00:20 -0500
committerAllan McRae <allan@archlinux.org>2013-01-28 23:38:46 +1000
commita64a713fc2a56cf6182e4e7c7c50533ad0afe32a (patch)
treed1e62ff791cd9aa4356d20ff9098b1611d718df2 /test/util/pacsorttest.sh
parent89ecf8cabebfd13e50473fba7fb98f65a52b02d8 (diff)
downloadpacman-a64a713fc2a56cf6182e4e7c7c50533ad0afe32a.tar.xz
pacsort: add -f, --files option for sorting filenames
Teach pacsort to understand package filenames and optionally strip away some of the context. alpm_pkg_vercmp() intentionally only understands pure versions, so strings such as '18.0-2-x86_64' and '18.0.1-1-x86_64' will be compared wrongly. Partially addresses FS#33455. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'test/util/pacsorttest.sh')
-rwxr-xr-xtest/util/pacsorttest.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/util/pacsorttest.sh b/test/util/pacsorttest.sh
index 9d52d694..9cbf619d 100755
--- a/test/util/pacsorttest.sh
+++ b/test/util/pacsorttest.sh
@@ -66,6 +66,24 @@ runtest $in $ex "add trailing newline"
in="1.0-1\n1.0\n1.0-2\n1.0\n"
runtest $in $in "stable sort"
+in="firefox-18.0-2-x86_64.pkg.tar.xz\nfirefox-18.0.1-1-x86_64.pkg.tar.xz\n"
+runtest $in $in "filename sort" "--files"
+
+in="firefox-18.0-2\nfirefox-18.0.1-1-x86_64.pkg.tar.xz\n"
+runtest $in $in "filename sort with invalid filename" "--files"
+
+in="firefox-18.0-2-x86_64.pkg.tar.xz\n/path2/firefox-18.0.1-1-x86_64.pkg.tar.xz\n"
+runtest $in $in "filename sort maybe with leading paths" "--files"
+
+in="/path1/firefox-18.0-2-x86_64.pkg.tar.xz\n/path2/firefox-18.0.1-1-x86_64.pkg.tar.xz\n"
+runtest $in $in "filename sort with different leading paths" "--files"
+
+in="/path2/firefox-18.0-2-x86_64.pkg.tar.xz\n/path1/path2/firefox-18.0.1-1-x86_64.pkg.tar.xz\n"
+runtest $in $in "filename sort with uneven leading path components" "--files"
+
+in="firefox-18.0-2-i686.pkg.tar.xz\nfirefox-18.0.1-1-x86_64.pkg.tar.gz\n"
+runtest $in $in "filename sort with different extensions" "--files"
+
# generate some long input/expected for the next few tests
declare normal reverse names_normal names_reverse
for ((i=1; i<600; i++)); do