summaryrefslogtreecommitdiffstats
path: root/tests/util.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/util.test')
-rw-r--r--tests/util.test66
1 files changed, 34 insertions, 32 deletions
diff --git a/tests/util.test b/tests/util.test
index 86271c5..c1ec6a5 100644
--- a/tests/util.test
+++ b/tests/util.test
@@ -6,61 +6,63 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
-package require tcltest 2.1
+package require tcltest 2.2
eval tcltest::configure $argv
tcltest::loadTestedCommands
+namespace import -force tcltest::test
listbox .l -width 20 -height 5 -relief sunken -bd 2
pack .l
.l insert 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
update
-test util-1.1 {Tk_GetScrollInfo procedure} {
- list [catch {.l yview moveto a b} msg] $msg
-} {1 {wrong # args: should be ".l yview moveto fraction"}}
-test util-1.2 {Tk_GetScrollInfo procedure} {
- list [catch {.l yview moveto xyz} msg] $msg
-} {1 {expected floating-point number but got "xyz"}}
-test util-1.3 {Tk_GetScrollInfo procedure} {
+test util-1.1 {Tk_GetScrollInfo procedure} -body {
+ .l yview moveto a b
+} -returnCodes error -result {wrong # args: should be ".l yview moveto fraction"}
+test util-1.2 {Tk_GetScrollInfo procedure} -body {
+ .l yview moveto xyz
+} -returnCodes error -result {expected floating-point number but got "xyz"}
+test util-1.3 {Tk_GetScrollInfo procedure} -body {
.l yview 0
.l yview moveto .5
.l yview
-} {0.5 0.75}
-test util-1.4 {Tk_GetScrollInfo procedure} {
- list [catch {.l yview scroll a} msg] $msg
-} {1 {wrong # args: should be ".l yview scroll number units|pages"}}
-test util-1.5 {Tk_GetScrollInfo procedure} {
- list [catch {.l yview scroll a b c} msg] $msg
-} {1 {wrong # args: should be ".l yview scroll number units|pages"}}
-test util-1.6 {Tk_GetScrollInfo procedure} {
- list [catch {.l yview scroll xyz units} msg] $msg
-} {1 {expected integer but got "xyz"}}
-test util-1.7 {Tk_GetScrollInfo procedure} {
+} -result {0.5 0.75}
+test util-1.4 {Tk_GetScrollInfo procedure} -body {
+ .l yview scroll a
+} -returnCodes error -result {wrong # args: should be ".l yview scroll number units|pages"}
+test util-1.5 {Tk_GetScrollInfo procedure} -body {
+ .l yview scroll a b c
+} -returnCodes error -result {wrong # args: should be ".l yview scroll number units|pages"}
+test util-1.6 {Tk_GetScrollInfo procedure} -body {
+ .l yview scroll xyz units
+} -returnCodes error -result {expected integer but got "xyz"}
+test util-1.7 {Tk_GetScrollInfo procedure} -body {
.l yview 0
.l yview scroll 2 pages
.l nearest 0
-} {6}
-test util-1.8 {Tk_GetScrollInfo procedure} {
+} -result {6}
+test util-1.8 {Tk_GetScrollInfo procedure} -body {
.l yview 15
.l yview scroll -2 pages
.l nearest 0
-} {9}
-test util-1.9 {Tk_GetScrollInfo procedure} {
+} -result {9}
+test util-1.9 {Tk_GetScrollInfo procedure} -body {
.l yview 0
.l yview scroll 2 units
.l nearest 0
-} {2}
-test util-1.10 {Tk_GetScrollInfo procedure} {
+} -result {2}
+test util-1.10 {Tk_GetScrollInfo procedure} -body {
.l yview 15
.l yview scroll -2 units
.l nearest 0
-} {13}
-test util-1.11 {Tk_GetScrollInfo procedure} {
- list [catch {.l yview scroll 3 zips} msg] $msg
-} {1 {bad argument "zips": must be units or pages}}
-test util-1.12 {Tk_GetScrollInfo procedure} {
- list [catch {.l yview dropdead 3 times} msg] $msg
-} {1 {unknown option "dropdead": must be moveto or scroll}}
+} -result {13}
+test util-1.11 {Tk_GetScrollInfo procedure} -body {
+ .l yview scroll 3 zips
+} -returnCodes error -result {bad argument "zips": must be units or pages}
+test util-1.12 {Tk_GetScrollInfo procedure} -body {
+ .l yview dropdead 3 times
+} -returnCodes error -result {unknown option "dropdead": must be moveto or scroll}
# cleanup
cleanupTests
return
+