summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2011-08-02 17:37:41 +0200
committerJim Meyering <meyering@redhat.com>2011-08-02 17:47:25 +0200
commitc08a9c69de4833384539c3296927a1e329d7f6e4 (patch)
tree8b613f8b2812a825bb5c31f28d7780bc6da11d75
parent3849c7c1e47e70ab9dd0d188afb9618982c7883c (diff)
downloadidutils-c08a9c69de4833384539c3296927a1e329d7f6e4.tar.gz
idutils-c08a9c69de4833384539c3296927a1e329d7f6e4.tar.bz2
idutils-c08a9c69de4833384539c3296927a1e329d7f6e4.zip
tests: add a test for the lid radix-handling bug
* testsuite/lid-radix: New file. * testsuite/Makefile.am (TESTS): Add it. * NEWS (Bug fixes): Mention it.
-rw-r--r--NEWS2
-rw-r--r--testsuite/Makefile.am1
-rwxr-xr-xtestsuite/lid-radix50
3 files changed, 53 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index e166d4c..b664c35 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,8 @@ GNU idutils NEWS -*- outline -*-
lid -L no longer mishandles open-ended ranges like "..2" and "2.."
+ lid's -d, -o and -x options now work properly
+
* Noteworthy changes in release 4.5 (2010-06-17) [stable]
diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am
index a31ce49..dfa3477 100644
--- a/testsuite/Makefile.am
+++ b/testsuite/Makefile.am
@@ -5,6 +5,7 @@ TESTS = \
files0-from \
help-version \
infloop-kawa-el \
+ lid-radix \
lid-range
EXTRA_DIST = \
diff --git a/testsuite/lid-radix b/testsuite/lid-radix
new file mode 100755
index 0000000..63922ba
--- /dev/null
+++ b/testsuite/lid-radix
@@ -0,0 +1,50 @@
+#!/bin/sh
+# Demonstrate how lid's -o, -d and -x options work
+
+# Copyright (C) 2011 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+
+echo 255 > d.txt || framework_failure_
+echo 0255 >d2.txt || framework_failure_
+echo 0377 > o.txt || framework_failure_
+echo 377 > o2.txt || framework_failure_
+echo 0xff > x.txt || framework_failure_
+echo ff > x2.txt || framework_failure_
+
+echo '*.txt text' > map || framework_failure_
+
+mkid -m map || framework_failure_
+
+cat <<EOF > exp.all
+d.txt
+o.txt
+x.txt
+EOF
+
+for i in d o x; do
+ echo $i.txt > exp.$i || framework_failure_
+done
+
+lid --key=none 0xff > out || fail=1
+compare out exp.all || fail=1
+
+for i in d o x; do
+ lid --key=none -$i 0xff > out || fail=1
+ compare out exp.$i || fail=1
+done
+
+Exit $fail