| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
# |
| 4 |
# This file is part of util-linux. |
| 5 |
# |
| 6 |
# This file is free software; you can redistribute it and/or modify |
| 7 |
# it under the terms of the GNU General Public License as published by |
| 8 |
# the Free Software Foundation; either version 2 of the License, or |
| 9 |
# (at your option) any later version. |
| 10 |
# |
| 11 |
# This file is distributed in the hope that it will be useful, |
| 12 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
# GNU General Public License for more details. |
| 15 |
# |
| 16 |
|
| 17 |
TS_TOPDIR="${0%/*}/../.." |
| 18 |
TS_DESC="color with week numbers" |
| 19 |
|
| 20 |
. "$TS_TOPDIR"/functions.sh |
| 21 |
ts_init "$*" |
| 22 |
|
| 23 |
ts_check_test_command "$TS_CMD_CAL" |
| 24 |
ts_inhibit_custom_colorscheme |
| 25 |
|
| 26 |
ts_skip_ncurses |
| 27 |
|
| 28 |
# --color output depends on terminal type |
| 29 |
export TERM=linux |
| 30 |
|
| 31 |
USETERM=$( ts_has_option "useterm" "$*" ) |
| 32 |
|
| 33 |
[ "$USETERM" == "yes" ] && TS_VERBOSE="yes" |
| 34 |
|
| 35 |
function call_cal { |
| 36 |
if [ "$USETERM" == "yes" ]; then |
| 37 |
XDG_CONFIG_HOME="$TS_SELF" $TS_CMD_CAL --color=always "$@" |
| 38 |
fi |
| 39 |
XDG_CONFIG_HOME="$TS_SELF" $TS_CMD_CAL --color=always "$@" >> $TS_OUTPUT |
| 40 |
} |
| 41 |
|
| 42 |
ts_init_subtest "first-day-week-numbers" |
| 43 |
call_cal --week --color=always 1 1 1 |
| 44 |
ts_finalize_subtest |
| 45 |
|
| 46 |
ts_init_subtest "reformation-corner-cases-1-week-numbers" |
| 47 |
call_cal --week --color=always 2 9 1752 |
| 48 |
ts_finalize_subtest |
| 49 |
|
| 50 |
ts_init_subtest "reformation-corner-cases-2-week-numbers" |
| 51 |
call_cal --week --color=always 3 9 1752 |
| 52 |
ts_finalize_subtest |
| 53 |
|
| 54 |
ts_init_subtest "reformation-corner-cases-3-week-numbers" |
| 55 |
call_cal --week --color=always 13 9 1752 |
| 56 |
ts_finalize_subtest |
| 57 |
|
| 58 |
ts_init_subtest "reformation-corner-cases-4-week-numbers" |
| 59 |
call_cal --week --color=always 14 9 1752 |
| 60 |
ts_finalize_subtest |
| 61 |
|
| 62 |
ts_init_subtest "last-day-week-numbers" |
| 63 |
call_cal --week --color=always -3 31 12 9999 |
| 64 |
ts_finalize_subtest |
| 65 |
|
| 66 |
ts_finalize |