diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-31 00:10:18 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-31 00:10:18 +0100 |
commit | ed910c750d7908a31262488e04d38b7bf3d75322 (patch) | |
tree | 67b8e0385ab171988cf278acb17b516ef6c868b0 | |
parent | e17764c8fb566f85020217dd8fd05fb6bc227e98 (diff) | |
download | busybox-w32-ed910c750d7908a31262488e04d38b7bf3d75322.tar.gz busybox-w32-ed910c750d7908a31262488e04d38b7bf3d75322.tar.bz2 busybox-w32-ed910c750d7908a31262488e04d38b7bf3d75322.zip |
cal: add a unicode test
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | coreutils/cal.c | 5 | ||||
-rwxr-xr-x | testsuite/cal.tests | 39 | ||||
-rwxr-xr-x | testsuite/runtest | 5 |
3 files changed, 46 insertions, 3 deletions
diff --git a/coreutils/cal.c b/coreutils/cal.c index 207fa967b..79fe074f8 100644 --- a/coreutils/cal.c +++ b/coreutils/cal.c | |||
@@ -113,7 +113,10 @@ int cal_main(int argc UNUSED_PARAM, char **argv) | |||
113 | if (argv[2]) { | 113 | if (argv[2]) { |
114 | bb_show_usage(); | 114 | bb_show_usage(); |
115 | } | 115 | } |
116 | month = xatou_range(*argv++, 1, 12); | 116 | if (!(flags & 2)) { /* no -y */ |
117 | month = xatou_range(*argv, 1, 12); | ||
118 | } | ||
119 | argv++; | ||
117 | } | 120 | } |
118 | year = xatou_range(*argv, 1, 9999); | 121 | year = xatou_range(*argv, 1, 9999); |
119 | } | 122 | } |
diff --git a/testsuite/cal.tests b/testsuite/cal.tests new file mode 100755 index 000000000..36be2b4b5 --- /dev/null +++ b/testsuite/cal.tests | |||
@@ -0,0 +1,39 @@ | |||
1 | #!/bin/sh | ||
2 | # Copyright 2010 by Denys Vlasenko | ||
3 | # Licensed under GPL v2, see file LICENSE for details. | ||
4 | |||
5 | . ./testing.sh | ||
6 | |||
7 | test -f "$bindir/.config" && . "$bindir/.config" | ||
8 | |||
9 | # testing "test name" "command" "expected result" "file input" "stdin" | ||
10 | |||
11 | testing "cal 2000" "cal 1 2000" "\ | ||
12 | January 2000 | ||
13 | Su Mo Tu We Th Fr Sa | ||
14 | 1 | ||
15 | 2 3 4 5 6 7 8 | ||
16 | 9 10 11 12 13 14 15 | ||
17 | 16 17 18 19 20 21 22 | ||
18 | 23 24 25 26 27 28 29 | ||
19 | 30 31 | ||
20 | " "" "" | ||
21 | |||
22 | test x"$CONFIG_LOCALE_SUPPORT" = x"y" \ | ||
23 | && test x"$CONFIG_FEATURE_ASSUME_UNICODE" = x"y" \ | ||
24 | && test x"$CONFIG_LAST_SUPPORTED_WCHAR" = x"0" \ | ||
25 | && test x"$CONFIG_UNICODE_WIDE_WCHARS" = x"y" \ | ||
26 | && test x"$CONFIG_STATIC" != x"y" \ | ||
27 | && test x"$CONFIG_CROSS_COMPILER_PREFIX" = x"" \ | ||
28 | && testing "unicode cal 2000" "LANG=zh_TW.utf8 cal 1 2000" "\ | ||
29 | 一月 2000 | ||
30 | 日 一 二 三 四 五 六 | ||
31 | 1 | ||
32 | 2 3 4 5 6 7 8 | ||
33 | 9 10 11 12 13 14 15 | ||
34 | 16 17 18 19 20 21 22 | ||
35 | 23 24 25 26 27 28 29 | ||
36 | 30 31 | ||
37 | " "" "" | ||
38 | |||
39 | exit $FAILCOUNT | ||
diff --git a/testsuite/runtest b/testsuite/runtest index 10563d7b2..5c185c5fb 100755 --- a/testsuite/runtest +++ b/testsuite/runtest | |||
@@ -78,9 +78,10 @@ run_oldstyle_applet_tests() | |||
78 | 78 | ||
79 | 79 | ||
80 | lcwd=$(pwd) | 80 | lcwd=$(pwd) |
81 | [ x"$tsdir" != x ] || tsdir="$lcwd" | 81 | [ x"$tsdir" != x"" ] || tsdir="$lcwd" |
82 | [ x"$bindir" != x ] || bindir="${lcwd%/*}" # one directory up from $lcwd | 82 | [ x"$bindir" != x"" ] || bindir="${lcwd%/*}" # one directory up from $lcwd |
83 | PATH="$bindir:$PATH" | 83 | PATH="$bindir:$PATH" |
84 | export bindir # some tests need to look at $bindir/.config | ||
84 | 85 | ||
85 | if [ x"$VERBOSE" = x ]; then | 86 | if [ x"$VERBOSE" = x ]; then |
86 | export VERBOSE= | 87 | export VERBOSE= |