diff options
author | Karel Zak | 2018-01-22 15:59:06 +0100 |
---|---|---|
committer | Karel Zak | 2018-01-22 16:01:14 +0100 |
commit | 5b9138d9526e3755301cd3db0c934a49a100bc6f (patch) | |
tree | 632838dbe50274603acdcd84705d9cfa3a732034 /tests/ts | |
parent | tests: merge 1m and 3m cal(1) tests (diff) | |
download | kernel-qcow2-util-linux-5b9138d9526e3755301cd3db0c934a49a100bc6f.tar.gz kernel-qcow2-util-linux-5b9138d9526e3755301cd3db0c934a49a100bc6f.tar.xz kernel-qcow2-util-linux-5b9138d9526e3755301cd3db0c934a49a100bc6f.zip |
tests: merge year cal(1) tests
* merge tests
* use subtests for cal(1) calls
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'tests/ts')
-rwxr-xr-x | tests/ts/cal/year | 50 | ||||
-rwxr-xr-x | tests/ts/cal/yearw | 60 |
2 files changed, 22 insertions, 88 deletions
diff --git a/tests/ts/cal/year b/tests/ts/cal/year index 77e847e28..6a8c42eaa 100755 --- a/tests/ts/cal/year +++ b/tests/ts/cal/year @@ -1,7 +1,7 @@ #!/bin/bash # -# Copyright (C) 2007 Karel Zak <kzak@redhat.com> +# Copyright (C) 2007-2018 Karel Zak <kzak@redhat.com> # # This file is part of util-linux. # @@ -28,33 +28,27 @@ export TERM=linux USETERM=$( ts_has_option "useterm" "$*" ) MYTIME="29 11 2006" -[ "$USETERM" == "yes" ] && TS_VERBOSE="yes" -ts_log "" - -ts_log "Gregorian - Monday-based week" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -ym $MYTIME -fi -$TS_CMD_CAL -ym $MYTIME >> $TS_OUTPUT - -ts_log "Gregorian - Sunday-based week" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -ys $MYTIME -fi -$TS_CMD_CAL -ys $MYTIME >> $TS_OUTPUT - - -ts_log "Julian - Monday-based week" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -ymj $MYTIME -fi -$TS_CMD_CAL -ymj $MYTIME >> $TS_OUTPUT - -ts_log "Julian - Sunday-based week" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -ysj $MYTIME -fi -$TS_CMD_CAL -ysj $MYTIME >> $TS_OUTPUT +function call_cal { + local testname=$(echo "$2" | sed 's/-//g') + + ts_init_subtest "$testname" + ts_log "$1" + shift + if [ "$USETERM" == "yes" ]; then + $TS_CMD_CAL "$@" + fi + $TS_CMD_CAL "$@" >> $TS_OUTPUT + ts_finalize_subtest +} + +call_cal "Gregorian - Monday-based week" -ym $MYTIME +call_cal "Gregorian - Sunday-based week" -ys $MYTIME +call_cal "Julian - Monday-based week" -ymj $MYTIME +call_cal "Julian - Sunday-based week" -ysj $MYTIME +call_cal "Gregorian - Monday-based week with week numbers" -ymw $MYTIME +call_cal "Gregorian - Sunday-based week with week numbers" -ysw $MYTIME +call_cal "Julian - Monday-based week with week numbers" -ymjw $MYTIME +call_cal "Julian - Sunday-based week with week numbers" -ysjw $MYTIME ts_finalize diff --git a/tests/ts/cal/yearw b/tests/ts/cal/yearw deleted file mode 100755 index 2f5d2c40c..000000000 --- a/tests/ts/cal/yearw +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash - -# -# Copyright (C) 2007 Karel Zak <kzak@redhat.com> -# -# This file is part of util-linux. -# -# This file 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 2 of the License, or -# (at your option) any later version. -# -# This file 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. -# -TS_TOPDIR="${0%/*}/../.." -TS_DESC="year with week numbers" - -. $TS_TOPDIR/functions.sh -ts_init "$*" - -ts_check_test_command "$TS_CMD_CAL" - -export TERM=linux - -USETERM=$( ts_has_option "useterm" "$*" ) -MYTIME="29 11 2006" - -[ "$USETERM" == "yes" ] && TS_VERBOSE="yes" -ts_log "" - -ts_log "Gregorian - Monday-based week with week numbers" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -ymw $MYTIME -fi -$TS_CMD_CAL -ymw $MYTIME >> $TS_OUTPUT - -ts_log "Gregorian - Sunday-based week with week numbers" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -ysw $MYTIME -fi -$TS_CMD_CAL -ysw $MYTIME >> $TS_OUTPUT - - -ts_log "Julian - Monday-based week with week numbers" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -ymjw $MYTIME -fi -$TS_CMD_CAL -ymjw $MYTIME >> $TS_OUTPUT - -ts_log "Julian - Sunday-based week with week numbers" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -ysjw $MYTIME -fi -$TS_CMD_CAL -ysjw $MYTIME >> $TS_OUTPUT - -ts_finalize - |