+2011-06-13 Stefano Lattarini <stefano.lattarini@gmail.com>
+
+ tests: test mdate-sh with /bin/sh too
+ * tests/mdate5.test: Fetch the `mdate-sh' script using the
+ `get_shell_script' function, and run it directly instead of
+ using `$SHELL'.
+ * tests/mdate6.test: Likewise. Since we are at it, make checks
+ on the `mdate-sh' output stricter, remove now unneeded calls to
+ aclocal and automake and creation/extension of `configure.in',
+ `Makefile.am' and `textutils.tex' files, and add a trailing `:'
+ command.
+ * tests/Makefile.am (config_shell_tests): Add `mdate5-w.shtst'
+ and `mdate6-w.shtst'.
+
2011-06-07 Stefano Lattarini <stefano.lattarini@gmail.com>
tests: `lib/' shell scripts transparently tested also with $SHELL
# Test to make sure mdate-sh works correctly.
. ./defs || Exit 1
-cat >> configure.in << 'END'
-AC_OUTPUT
-END
-cat > Makefile.am << 'END'
-info_TEXINFOS = textutils.texi
-END
+get_shell_script mdate-sh
-cat > textutils.texi << 'END'
-@include version.texi
-@setfilename textutils.info
-END
-
-$ACLOCAL
-$AUTOMAKE --add-missing
-
-set x `$SHELL ./mdate-sh Makefile.am`
+set x `./mdate-sh install-sh`
shift
+echo "$*" # For debugging.
+
# Check that mdate output looks like a date:
test $# = 3
case $1$3 in *[!0-9]*) Exit 1;; esac
test $1 -lt 32
+# Hopefully automake will be obsolete in 80 years ;-)
+case $3 in 20[0-9][0-9]) :;; *) Exit 1;; esac
+case $2 in
+ January|February|March|April|May|June|July|August) ;;
+ September|October|November|December) ;;
+ *) Exit 1
+esac
+
+# Stricter checks on the year required a POSIX date(1) command.
+if year=`date +%Y` && test $year -gt 2010; then
+ test $year = $3 || Exit 1
+fi
+
+:
( : > "$file" ) \
|| skip_ "file name with spaces and metacharacters not accepted"
-cp "$top_testsrcdir/lib/mdate-sh" .
-$SHELL ./mdate-sh "$file" >stdout 2>stderr ||
+get_shell_script mdate-sh
+
+./mdate-sh "$file" >stdout 2>stderr ||
{ cat stdout; cat stderr >&2; Exit 1; }
cat stdout
cat stderr >&2