summaryrefslogtreecommitdiffstats
path: root/tests/notify.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/notify.test')
-rw-r--r--tests/notify.test103
1 files changed, 38 insertions, 65 deletions
diff --git a/tests/notify.test b/tests/notify.test
index 5c29748..1e75d2b 100644
--- a/tests/notify.test
+++ b/tests/notify.test
@@ -10,7 +10,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# CVS: @(#) $Id: notify.test,v 1.2 2002/12/31 12:20:53 krischan Exp $
+# CVS: @(#) $Id: notify.test,v 1.3 2005/03/29 20:34:28 treectrl Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -18,7 +18,7 @@ if {[lsearch [namespace children] ::tcltest] == -1} {
}
package require Tk
-package_require treectrl
+package require treectrl
test notify-0.1 {some needed preparations} -body {
treectrl .t
@@ -30,7 +30,7 @@ test notify-1.1 {notify: missing args} -body {
test notify-1.2 {notify: unknown command} -body {
.t notify foo
-} -returnCodes error -result {bad command "foo": must be bind, configure, detailnames, eventnames, generate, install, linkage, or uninstall}
+} -returnCodes error -result {bad command "foo": must be *} -match glob
test notify-2.1 {notify eventnames: too much args} -body {
.t notify eventnames Open
@@ -42,23 +42,19 @@ test notify-2.2 {notify eventnames: nothing own installed yet} -body {
test notify-2.3 {notify install: missing args} -body {
.t notify install
-} -returnCodes error -result {wrong # args: should be ".t notify install option arg ..."}
+} -returnCodes error -result {wrong # args: should be ".t notify install pattern ?percentsCommand?"}
-test notify-2.4 {notify install: unknown command} -body {
+test notify-2.4 {notify install: bad pattern} -body {
.t notify install foo
-} -returnCodes error -result {bad option "foo": must be detail or event}
-
-test notify-2.5 {notify install event: missing args} -body {
- .t notify install event
-} -returnCodes error -result {wrong # args: should be ".t notify install event name ?percentsCommand?"}
+} -returnCodes error -result {missing "<" in event pattern "foo"}
test notify-2.6 {notify install event: too much args} -body {
- .t notify install event foo bar baz
-} -returnCodes error -result {wrong # args: should be ".t notify install event name ?percentsCommand?"}
+ .t notify install <foo> bar baz
+} -returnCodes error -result {wrong # args: should be ".t notify install pattern ?percentsCommand?"}
test notify-2.7 {notify install event} -body {
- .t notify install event Greetings
- .t notify install event GoodBye
+ .t notify install <Greetings>
+ .t notify install <GoodBye>
} -result {}
test notify-2.8 {notify eventnames: list Greetings} -body {
@@ -81,17 +77,9 @@ test notify-2.12 {notify detailnames: no details yet} -body {
.t notify detailnames Greetings
} -result {}
-test notify-2.13 {notify install detail: missing args} -body {
- .t notify install detail
-} -returnCodes error -result {wrong # args: should be ".t notify install detail event detail ?percentsCommand?"}
-
-test notify-2.14 {notify install detail: unknown event} -body {
- .t notify install detail Hello GoodBye
-} -returnCodes error -result {unknown event "Hello"}
-
test notify-2.15 {notify install detail} -body {
- .t notify install detail Greetings Wrote
- .t notify install detail Greetings Sent
+ .t notify install <Greetings-Wrote>
+ .t notify install <Greetings-Sent>
} -result {}
test notify-2.16 {notify detailnames} -body {
@@ -100,30 +88,30 @@ test notify-2.16 {notify detailnames} -body {
test notify-3.1 {notify linkage: missing args} -body {
.t notify linkage
-} -returnCodes error -result {wrong # args: should be ".t notify linkage event ?detail?"}
+} -returnCodes error -result {wrong # args: should be ".t notify linkage pattern"}
test notify-3.2 {notify linkage: unknown event} -body {
- .t notify linkage foo
+ .t notify linkage <foo>
} -returnCodes error -result {unknown event "foo"}
test notify-3.3 {notify linkage: standard event} -body {
- .t notify linkage Scroll
+ .t notify linkage <Scroll>
} -result {static}
test notify-3.4 {notify linkage: self made event} -body {
- .t notify linkage Greetings
+ .t notify linkage <Greetings>
} -result {dynamic}
test notify-3.5 {notify linkage: unknown detail} -body {
- .t notify linkage Greetings foo
+ .t notify linkage <Greetings-foo>
} -returnCodes error -result {unknown detail "foo" for event "Greetings"}
test notify-3.6 {notify linkage: standard event} -body {
- .t notify linkage Scroll x
+ .t notify linkage <Scroll-x>
} -result {static}
test notify-3.7 {notify linkage: self made event} -body {
- .t notify linkage Greetings Sent
+ .t notify linkage <Greetings-Sent>
} -result {dynamic}
test notify-4.1 {notify bind: too much args} -body {
@@ -211,7 +199,7 @@ test notify-5.7 {notify configure: dynamic event} -body {
test notify-6.1 {notify generate: missing args} -body {
.t notify generate
-} -returnCodes error -result {wrong # args: should be ".t notify generate pattern ?charMap?"}
+} -returnCodes error -result {wrong # args: should be ".t notify generate pattern ?charMap? ?percentsCommand?"}
test notify-6.2 {notify generate: invalid event} -body {
.t notify generate Greetings
@@ -270,20 +258,18 @@ test notify-6.13 {notify generate: not so much field args} -body {
}
test notify-6.14 {notify install/bind/generate: do some replacements} -body {
- .t notify install event Percent
- .t notify install detail Percent Test
+ .t notify install <Percent-Test>
.t notify bind .t <Percent-Test> \
{puts -nonewline "%%W: %2 %b %| %~ %2 %b%%"}
.t notify generate <Percent-Test> {2 to b be ~ not | or}
} -output {%W: to be or not to be%}
-proc doMyOwnSubst {field window eventName detail args} {
- return [string map {2 TO b BE ~ NOT | OR} $field]
+proc doMyOwnSubst {char object eventName detail charMap} {
+ return [string map {2 TO b BE ~ NOT | OR} $char]
}
test notify-6.15 {notify install/bind/generate: my own replacements} -body {
- .t notify uninstall detail Percent Test
- .t notify install detail Percent Test doMyOwnSubst
+ .t notify install <Percent-Test> doMyOwnSubst
.t notify bind .t <Percent-Test> \
{puts -nonewline "%%W: %2 %b %| %~ %2 %b%%"}
.t notify generate <Percent-Test>
@@ -294,9 +280,8 @@ test notify-6.16 {notify install/bind/generate: standard replacements} -body {
} -output {%W: TO BE OR NOT TO BE%}
test notify-6.17 {notify install/bind/generate: my own replacements} -body {
- .t notify uninstall detail Percent Test
- .t notify uninstall event Percent
- .t notify install event Percent doMyOwnSubst
+ .t notify uninstall <Percent-Test>
+ .t notify install <Percent> doMyOwnSubst
.t notify bind .t <Percent> \
{puts -nonewline "%%W: %2 %b %| %~ %2 %b%%"}
.t notify generate <Percent>
@@ -308,30 +293,26 @@ test notify-6.18 {notify install/bind/generate: standard replacements} -body {
test notify-7.1 {notify uninstall: missing args} -body {
.t notify uninstall
-} -returnCodes error -result {wrong # args: should be ".t notify uninstall option arg ..."}
+} -returnCodes error -result {wrong # args: should be ".t notify uninstall pattern"}
test notify-7.2 {notify uninstall: unknown command} -body {
.t notify uninstall foo
-} -returnCodes error -result {bad option "foo": must be detail or event}
+} -returnCodes error -result {missing "<" in event pattern "foo"}
-test notify-7.3 {notify uninstall detail: missing args} -body {
- .t notify uninstall detail
-} -returnCodes error -result {wrong # args: should be ".t notify uninstall detail event detail"}
-
-test notify-7.4 {notify uninstall detail: too much args} -body {
- .t notify uninstall detail foo bar baz
-} -returnCodes error -result {wrong # args: should be ".t notify uninstall detail event detail"}
+test notify-7.4 {notify uninstall: too much args} -body {
+ .t notify uninstall foo bar
+} -returnCodes error -result {wrong # args: should be ".t notify uninstall pattern"}
test notify-7.5 {notify uninstall detail: unknown event} -body {
- .t notify uninstall detail foo bar
+ .t notify uninstall <foo-bar>
} -returnCodes error -result {unknown event "foo"}
test notify-7.6 {notify uninstall detail: unknown detail} -body {
- .t notify uninstall detail Greetings GoodBye
+ .t notify uninstall <Greetings-GoodBye>
} -returnCodes error -result {unknown detail "GoodBye" for event "Greetings"}
test notify-7.7 {notify uninstall detail} -body {
- .t notify uninstall detail Greetings Sent
+ .t notify uninstall <Greetings-Sent>
} -result {}
test notify-7.8 {notify uninstall detail: double check} -body {
@@ -339,23 +320,15 @@ test notify-7.8 {notify uninstall detail: double check} -body {
} -result {-1}
test notify-7.9 {notify uninstall detail: delete a static detail} -body {
- .t notify uninstall detail Scroll x
+ .t notify uninstall <Scroll-x>
} -returnCodes error -result {can't uninstall static detail "x"}
-test notify-7.10 {notify uninstall event: missing args} -body {
- .t notify uninstall event
-} -returnCodes error -result {wrong # args: should be ".t notify uninstall event name"}
-
-test notify-7.11 {notify uninstall event: too much args} -body {
- .t notify uninstall event foo bar
-} -returnCodes error -result {wrong # args: should be ".t notify uninstall event name"}
-
test notify-7.12 {notify uninstall event: unknown event} -body {
- .t notify uninstall event foo
+ .t notify uninstall <foo>
} -returnCodes error -result {unknown event "foo"}
test notify-7.13 {notify uninstall event} -body {
- .t notify uninstall event Greetings
+ .t notify uninstall <Greetings>
} -result {}
test notify-7.14 {notify uninstall event: double check} -body {
@@ -363,7 +336,7 @@ test notify-7.14 {notify uninstall event: double check} -body {
} -result {-1}
test notify-7.15 {notify uninstall event: delete a static event} -body {
- .t notify uninstall event Scroll
+ .t notify uninstall <Scroll>
} -returnCodes error -result {can't uninstall static event "Scroll"}
test notify-99.1 {some needed cleanup} -body {