From b0636cc11af5bb2d022a2e9788dee076814bca2b Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 22 Jan 2018 15:53:00 +0100 Subject: tests: merge 1m and 3m cal(1) tests * merge tests * use subtests for cal(1) calls Signed-off-by: Karel Zak --- tests/ts/cal/1m | 61 --------------------------------------------------- tests/ts/cal/1mw | 61 --------------------------------------------------- tests/ts/cal/3m | 60 -------------------------------------------------- tests/ts/cal/3mw | 58 ------------------------------------------------- tests/ts/cal/month | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 64 insertions(+), 240 deletions(-) delete mode 100755 tests/ts/cal/1m delete mode 100755 tests/ts/cal/1mw delete mode 100755 tests/ts/cal/3m delete mode 100755 tests/ts/cal/3mw create mode 100755 tests/ts/cal/month (limited to 'tests/ts/cal') diff --git a/tests/ts/cal/1m b/tests/ts/cal/1m deleted file mode 100755 index 9f691e137..000000000 --- a/tests/ts/cal/1m +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash - -# -# Copyright (C) 2007 Karel Zak -# -# 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="1 month" - -. $TS_TOPDIR/functions.sh -ts_init "$*" - -ts_check_test_command "$TS_CMD_CAL" - -export TERM=linux - -USETERM=$( ts_has_option "useterm" "$*" ) -MYTIME="27 09 2006" - -[ "$USETERM" == "yes" ] && TS_VERBOSE="yes" -ts_log "" - -ts_log "Gregorian - Monday-based week" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -1m $MYTIME -fi -$TS_CMD_CAL -1m $MYTIME >> $TS_OUTPUT - -ts_log "Gregorian - Sunday-based week" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -1s $MYTIME -fi -$TS_CMD_CAL -1s $MYTIME >> $TS_OUTPUT - - -ts_log "Julian - Monday-based week" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -1mj $MYTIME -fi -$TS_CMD_CAL -1mj $MYTIME >> $TS_OUTPUT - -ts_log "Julian - Sunday-based week" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -1sj $MYTIME -fi -$TS_CMD_CAL -1sj $MYTIME >> $TS_OUTPUT - -ts_finalize - diff --git a/tests/ts/cal/1mw b/tests/ts/cal/1mw deleted file mode 100755 index 3234a6adb..000000000 --- a/tests/ts/cal/1mw +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash - -# -# Copyright (C) 2007 Karel Zak -# -# 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="1 month 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="27 09 2006" - -[ "$USETERM" == "yes" ] && TS_VERBOSE="yes" -ts_log "" - -ts_log "Gregorian - Monday-based week with week numbers" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -1mw $MYTIME -fi -$TS_CMD_CAL -1mw $MYTIME >> $TS_OUTPUT - -ts_log "Gregorian - Sunday-based week with week numbers" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -1sw $MYTIME -fi -$TS_CMD_CAL -1sw $MYTIME >> $TS_OUTPUT - - -ts_log "Julian - Monday-based week with week numbers" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -1mjw $MYTIME -fi -$TS_CMD_CAL -1mjw $MYTIME >> $TS_OUTPUT - -ts_log "Julian - Sunday-based week with week numbers" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -1sjw $MYTIME -fi -$TS_CMD_CAL -1sjw $MYTIME >> $TS_OUTPUT - -ts_finalize - diff --git a/tests/ts/cal/3m b/tests/ts/cal/3m deleted file mode 100755 index baa9ba314..000000000 --- a/tests/ts/cal/3m +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash - -# -# Copyright (C) 2007 Karel Zak -# -# 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="3 months" - -. $TS_TOPDIR/functions.sh -ts_init "$*" - -ts_check_test_command "$TS_CMD_CAL" - -export TERM=linux - -USETERM=$( ts_has_option "useterm" "$*" ) -MYTIME="27 09 2006" - -[ "$USETERM" == "yes" ] && TS_VERBOSE="yes" -ts_log "" - -ts_log "Gregorian - Monday-based week" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -3m $MYTIME -fi -$TS_CMD_CAL -3m $MYTIME >> $TS_OUTPUT - -ts_log "Gregorian - Sunday-based week" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -3s $MYTIME -fi -$TS_CMD_CAL -3s $MYTIME >> $TS_OUTPUT - - -ts_log "Julian - Monday-based week" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -3mj $MYTIME -fi -$TS_CMD_CAL -3mj $MYTIME >> $TS_OUTPUT - -ts_log "Julian - Sunday-based week" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -3sj $MYTIME -fi -$TS_CMD_CAL -3sj $MYTIME >> $TS_OUTPUT - -ts_finalize - diff --git a/tests/ts/cal/3mw b/tests/ts/cal/3mw deleted file mode 100755 index cb3905b18..000000000 --- a/tests/ts/cal/3mw +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash - -# -# Copyright (C) 2007 Karel Zak -# -# 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="3 months with week numbers" - -. $TS_TOPDIR/functions.sh -ts_init "$*" - -ts_check_test_command "$TS_CMD_CAL" - -USETERM=$( ts_has_option "useterm" "$*" ) -MYTIME="27 09 2006" - -[ "$USETERM" == "yes" ] && TS_VERBOSE="yes" -ts_log "" - -ts_log "Gregorian - Monday-based week with week numbers" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -3mw $MYTIME -fi -$TS_CMD_CAL -3mw $MYTIME >> $TS_OUTPUT - -ts_log "Gregorian - Sunday-based week with week numbers" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -3sw $MYTIME -fi -$TS_CMD_CAL -3sw $MYTIME >> $TS_OUTPUT - - -ts_log "Julian - Monday-based week with week numbers" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -3mjw $MYTIME -fi -$TS_CMD_CAL -3mjw $MYTIME >> $TS_OUTPUT - -ts_log "Julian - Sunday-based week with week numbers" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -3sjw $MYTIME -fi -$TS_CMD_CAL -3sjw $MYTIME >> $TS_OUTPUT - -ts_finalize - diff --git a/tests/ts/cal/month b/tests/ts/cal/month new file mode 100755 index 000000000..ba4e07af0 --- /dev/null +++ b/tests/ts/cal/month @@ -0,0 +1,64 @@ +#!/bin/bash + +# +# Copyright (C) 2007-2018 Karel Zak +# +# 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="month" + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_CAL" + +export TERM=linux + +USETERM=$( ts_has_option "useterm" "$*" ) +MYTIME="27 09 2006" + +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" -1m $MYTIME +call_cal "Gregorian - Sunday-based week" -1s $MYTIME +call_cal "Julian - Monday-based week" -1mj $MYTIME +call_cal "Julian - Sunday-based week" -1sj $MYTIME +call_cal "Gregorian - Monday-based week with week numbers" -1mw $MYTIME +call_cal "Gregorian - Sunday-based week with week numbers" -1sw $MYTIME +call_cal "Julian - Monday-based week with week numbers" -1mjw $MYTIME +call_cal "Julian - Sunday-based week with week numbers" -1sjw $MYTIME +call_cal "Gregorian - Monday-based week" -3m $MYTIME +call_cal "Gregorian - Sunday-based week" -3s $MYTIME +call_cal "Julian - Monday-based week" -3mj $MYTIMET +call_cal "Julian - Sunday-based week" -3sj $MYTIME +call_cal "Gregorian - Monday-based week with week numbers" -3mw $MYTIME +call_cal "Gregorian - Sunday-based week with week numbers" -3sw $MYTIME +call_cal "Julian - Monday-based week with week numbers" -3mjw $MYTIME +call_cal "Julian - Sunday-based week with week numbers" -3sjw $MYTIME + +ts_finalize + -- cgit v1.2.3-55-g7522