diff options
author | Karel Zak | 2018-01-22 16:55:07 +0100 |
---|---|---|
committer | Karel Zak | 2018-01-22 16:55:07 +0100 |
commit | 940b55ac4bdee3cb9bff87f9c83988d25957f45f (patch) | |
tree | e959be168bf673ccef1115b88132c173284e85f2 /tests/ts/cal | |
parent | test: use subtests for jan1753 cal(1) test (diff) | |
download | kernel-qcow2-util-linux-940b55ac4bdee3cb9bff87f9c83988d25957f45f.tar.gz kernel-qcow2-util-linux-940b55ac4bdee3cb9bff87f9c83988d25957f45f.tar.xz kernel-qcow2-util-linux-940b55ac4bdee3cb9bff87f9c83988d25957f45f.zip |
tests: use subtests for weekarg cal(1) tests
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'tests/ts/cal')
-rwxr-xr-x | tests/ts/cal/weekarg | 164 |
1 files changed, 49 insertions, 115 deletions
diff --git a/tests/ts/cal/weekarg b/tests/ts/cal/weekarg index 236baedd5..d26906ee1 100755 --- a/tests/ts/cal/weekarg +++ b/tests/ts/cal/weekarg @@ -32,133 +32,67 @@ export TERM=linux USETERM=$( ts_has_option "useterm" "$*" ) -[ "$USETERM" == "yes" ] && TS_VERBOSE="yes" -ts_log "" +function call_cal_simple { + ts_log "$1" + shift + if [ "$USETERM" == "yes" ]; then + $TS_CMD_CAL "$@" + fi + $TS_CMD_CAL "$@" >> $TS_OUTPUT +} + +function call_cal { + local testname=$(echo "${2}" | sed 's/-//g') + testname="${testname}-$(echo "${3}" | sed 's/=//g;s/-//g')" + + ts_init_subtest "$testname" + call_cal_simple "$@" + ts_finalize_subtest +} + +function call_cal_color { + local testname=$(echo "${2}" | sed 's/-//g') + testname="${testname}-$(echo "${3}" | sed 's/=//g;s/-//g')-color" + + ts_init_subtest "$testname" + call_cal_simple "$@" --color=always + ts_finalize_subtest +} MYTIME="7 10 2013" PWEEK="week 40" WEEK="--week=40" -ts_log "Gregorian - Monday-based, $PWEEK, 3 month $x" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -3m $WEEK $MYTIME -fi -$TS_CMD_CAL -3m $WEEK $MYTIME >> $TS_OUTPUT - -ts_log "Gregorian - Sunday-based, $PWEEK, 3 month $x" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -3s $WEEK $MYTIME -fi -$TS_CMD_CAL -3s $WEEK $MYTIME >> $TS_OUTPUT - - -ts_log "Julian - Monday-based, $PWEEK, 3 month $x" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -3mj $WEEK $MYTIME -fi -$TS_CMD_CAL -3mj $WEEK $MYTIME >> $TS_OUTPUT - -ts_log "Julian - Sunday-based, $PWEEK, 3 month $x" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -3sj $WEEK $MYTIME -fi -$TS_CMD_CAL -3sj $WEEK $MYTIME >> $TS_OUTPUT - -ts_log "Gregorian - Monday-based, $PWEEK, 1 month $x" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -m $WEEK $MYTIME -fi -$TS_CMD_CAL -m $WEEK $MYTIME >> $TS_OUTPUT - -ts_log "Gregorian - Sunday-based, $PWEEK, 1 month $x" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -s $WEEK $MYTIME -fi -$TS_CMD_CAL -s $WEEK $MYTIME >> $TS_OUTPUT - - -ts_log "Julian - Monday-based, $PWEEK, 1 month $x" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -mj $WEEK $MYTIME -fi -$TS_CMD_CAL -mj $WEEK $MYTIME >> $TS_OUTPUT - -ts_log "Julian - Sunday-based, $PWEEK, 1 month $x" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -sj $WEEK $MYTIME -fi -$TS_CMD_CAL -sj $WEEK $MYTIME >> $TS_OUTPUT +call_cal "Gregorian - Monday-based, $PWEEK, 3 month" -3m $WEEK $MYTIME +call_cal "Gregorian - Sunday-based, $PWEEK, 3 month" -3s $WEEK $MYTIME +call_cal "Julian - Monday-based, $PWEEK, 3 month" -3mj $WEEK $MYTIME +call_cal "Julian - Sunday-based, $PWEEK, 3 month" -3sj $WEEK $MYTIME +call_cal "Gregorian - Monday-based, $PWEEK, 1 month" -m $WEEK $MYTIME +call_cal "Gregorian - Sunday-based, $PWEEK, 1 month" -s $WEEK $MYTIME +call_cal "Julian - Monday-based, $PWEEK, 1 month" -mj $WEEK $MYTIME +call_cal "Julian - Sunday-based, $PWEEK, 1 month" -sj $WEEK $MYTIME + +call_cal_color "Gregorian - Monday-based, $PWEEK, 3 month" -3m $WEEK $MYTIME +call_cal_color "Julian - Monday-based, $PWEEK, 3 month" -3mj $WEEK $MYTIME # tricky year, starts with a bit of 53 yet ends during 52 MYTIME="2010" PWEEK="week 53" WEEK="--week=53" -ts_log "Gregorian - Monday-based, $PWEEK, 1 month $x" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -1m $WEEK $MYTIME -fi -$TS_CMD_CAL -1m $WEEK $MYTIME >> $TS_OUTPUT - -ts_log "Julian - Monday-based, $PWEEK, 1 month $x" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -1mj $WEEK $MYTIME -fi -$TS_CMD_CAL -1mj $WEEK $MYTIME >> $TS_OUTPUT - -MYTIME="2010" -PWEEK="week 53 with colors" -WEEK="--week=53 --color=always" -ts_log "Gregorian - Monday-based, $PWEEK, 1 month $x" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -1m $WEEK $MYTIME -fi -$TS_CMD_CAL -1m $WEEK $MYTIME >> $TS_OUTPUT - -ts_log "Julian - Monday-based, $PWEEK, 1 month $x" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -1mj $WEEK $MYTIME -fi -$TS_CMD_CAL -1mj $WEEK $MYTIME >> $TS_OUTPUT - -MYTIME="7 10 2013" -PWEEK="week 40 with colors" -WEEK="--week=40 --color=always" -ts_log "Gregorian - Monday-based, $PWEEK, 3 month $x" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -3m $WEEK $MYTIME -fi -$TS_CMD_CAL -3m $WEEK $MYTIME >> $TS_OUTPUT - -ts_log "Julian - Monday-based, $PWEEK, 3 month $x" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL -3mj $WEEK $MYTIME -fi -$TS_CMD_CAL -3mj $WEEK $MYTIME >> $TS_OUTPUT +call_cal "Gregorian - Monday-based, $PWEEK, 1 month" -1m $WEEK $MYTIME +call_cal "Julian - Monday-based, $PWEEK, 1 month" -1mj $WEEK $MYTIME +call_cal_color "Gregorian - Monday-based, $PWEEK, 3 month" -3m $WEEK $MYTIME +call_cal_color "Gregorian - Monday-based, $PWEEK, 1 month" -1m $WEEK $MYTIME +call_cal_color "Julian - Monday-based, $PWEEK, 1 month" -1mj $WEEK $MYTIME MYTIME="31 12 2000" -PWEEK="week 54 with colors" -WEEK="--week=54 --color=always" -ts_log "Gregorian - Sunday-based, $PWEEK, 3 month $x" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL --three --sunday $WEEK $MYTIME -fi -$TS_CMD_CAL --three --sunday $WEEK $MYTIME >> $TS_OUTPUT - -PWEEK="week 53 with colors" -WEEK="--week=53 --color=always" -ts_log "Gregorian - Monday-based, $PWEEK, 3 month $x" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL --three --monday $WEEK $MYTIME -fi -$TS_CMD_CAL --three --monday $WEEK $MYTIME >> $TS_OUTPUT 2>&1 - -PWEEK="week 52 with colors" -WEEK="--week=52 --color=always" -ts_log "Gregorian - Monday-based, $PWEEK, 3 month $x" -if [ "$USETERM" == "yes" ]; then - $TS_CMD_CAL --three --monday $WEEK $MYTIME -fi -$TS_CMD_CAL --three --monday $WEEK $MYTIME >> $TS_OUTPUT 2>&1 +PWEEK="week 54" +WEEK="--week=54" +call_cal_color "Gregorian - Sunday-based, $PWEEK, 3 month" -3s $WEEK $MYTIME +MYTIME="31 12 2000" +PWEEK="week 52" +WEEK="--week=52" +call_cal_color "Gregorian - Monday-based, $PWEEK, 3 month" -3m $WEEK $MYTIME ts_finalize |