summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pool <mbp@sourcefrog.net>2016-01-02 12:03:38 -0800
committerMartin Pool <mbp@sourcefrog.net>2016-01-02 12:03:38 -0800
commit45503915cd2ddae98e793748b471c4097a17241d (patch)
treee049bc9cff2f282ed5d8b293da5797e22d1dc9dd
parentaa1dbdfe95c32548b233147dc829c94cedb738f0 (diff)
downloadlibrsync-45503915cd2ddae98e793748b471c4097a17241d.tar.gz
Add a test for bad options to rdiff
-rw-r--r--CMakeLists.txt5
-rwxr-xr-xtests/rdiff_bad_option.sh28
2 files changed, 32 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 148e55c..be1ae66 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -171,6 +171,10 @@ execute_process(COMMAND ${PERL_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/src/mkpr
# Testing
+add_test(NAME rdiff_bad_option
+ COMMAND rdiff_bad_option.sh ${CMAKE_CURRENT_BINARY_DIR}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests)
+
add_executable(isprefix_test tests/isprefix_test.c src/isprefix.c)
add_test(NAME isprefix_test COMMAND isprefix_test)
@@ -183,7 +187,6 @@ add_test(NAME Triple COMMAND triple.test ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIR
add_test(NAME Delta COMMAND delta.test ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests)
add_test(NAME Changes COMMAND changes.test ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests)
-
enable_testing()
# Create conf files
diff --git a/tests/rdiff_bad_option.sh b/tests/rdiff_bad_option.sh
new file mode 100755
index 0000000..f6d4f90
--- /dev/null
+++ b/tests/rdiff_bad_option.sh
@@ -0,0 +1,28 @@
+#! /bin/bash -ex
+
+# librsync -- the library for network deltas
+
+# Copyright (C) 2016 by Martin Pool
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public License
+# as published by the Free Software Foundation; either version 2.1 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+
+# Bad command-line options return an error and print a message.
+
+errout=`mktemp`
+trap "rm $errout" EXIT
+! $1/rdiff --imaginary-option 2>"$errout"
+cat "$errout"
+grep 'unknown option: --imaginary-option' "$errout"