summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/textMark.test202
1 files changed, 58 insertions, 144 deletions
diff --git a/tests/textMark.test b/tests/textMark.test
index 2942cba..9c61c40 100644
--- a/tests/textMark.test
+++ b/tests/textMark.test
@@ -6,14 +6,13 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: textMark.test,v 1.11 2008/08/28 08:52:06 aniap Exp $
+# RCS: @(#) $Id: textMark.test,v 1.12 2008/12/06 09:51:55 dkf Exp $
package require tcltest 2.2
namespace import ::tcltest::*
-eval tcltest::configure $argv
+tcltest::configure {*}$argv
tcltest::loadTestedCommands
-
destroy .t
text .t -width 20 -height 10
pack append . .t {top expand fill}
@@ -30,85 +29,57 @@ bOy GIrl .#@? x_yz
!@#$%
Line 7"
-testConstraint haveCourier12 [expr {[catch {
- .t configure -font {Courier 12}
-}] == 0}]
-
-# The statements below reset the main window; it's needed if the window
+# The statements below reset the main window; it's needed if the window
# manager is mwm to make mwm forget about a previous minimum size setting.
wm withdraw .
wm minsize . 1 1
wm positionfrom . user
wm deiconify .
-
-
-test textMark-1.1 {TkTextMarkCmd - missing option} -constraints {
- haveCourier12
-} -body {
+
+test textMark-1.1 {TkTextMarkCmd - missing option} -returnCodes error -body {
.t mark
-} -returnCodes error -result {wrong # args: should be ".t mark option ?arg ...?"}
-test textMark-1.2 {TkTextMarkCmd - bogus option} -constraints {
- haveCourier12
-} -body {
+} -result {wrong # args: should be ".t mark option ?arg ...?"}
+test textMark-1.2 {TkTextMarkCmd - bogus option} -returnCodes error -body {
.t mark gorp
-} -returnCodes error -result {bad mark option "gorp": must be gravity, names, next, previous, set, or unset}
-test textMark-1.3 {TkTextMarkCmd - "gravity" option} -constraints {
- haveCourier12
-} -body {
+} -match glob -result {bad mark option "gorp": must be *}
+test textMark-1.3 {TkTextMarkCmd - "gravity" option} -returnCodes error -body {
.t mark gravity foo
-} -returnCodes error -result {there is no mark named "foo"}
-test textMark-1.4 {TkTextMarkCmd - "gravity" option} -constraints {
- haveCourier12
-} -body {
+} -result {there is no mark named "foo"}
+test textMark-1.4 {TkTextMarkCmd - "gravity" option} -body {
.t mark set x 1.3
.t insert 1.3 x
list [.t mark gravity x] [.t index x]
} -result {right 1.4}
-test textMark-1.5 {TkTextMarkCmd - "gravity" option} -constraints {
- haveCourier12
-} -body {
+test textMark-1.5 {TkTextMarkCmd - "gravity" option} -body {
.t mark set x 1.3
.t mark g x left
.t insert 1.3 x
list [.t mark gravity x] [.t index x]
} -result {left 1.3}
-test textMark-1.6 {TkTextMarkCmd - "gravity" option} -constraints {
- haveCourier12
-} -body {
+test textMark-1.6 {TkTextMarkCmd - "gravity" option} -body {
.t mark set x 1.3
.t mark gravity x right
.t insert 1.3 x
list [.t mark gravity x] [.t index x]
} -result {right 1.4}
-test textMark-1.7 {TkTextMarkCmd - "gravity" option} -constraints {
- haveCourier12
-} -body {
+test textMark-1.7 {TkTextMarkCmd - "gravity" option} -returnCodes error -body {
.t mark set x 1.3
.t mark gravity x gorp
-} -returnCodes error -result {bad mark gravity "gorp": must be left or right}
-test textMark-1.8 {TkTextMarkCmd - "gravity" option} -constraints {
- haveCourier12
-} -body {
+} -result {bad mark gravity "gorp": must be left or right}
+test textMark-1.8 {TkTextMarkCmd - "gravity" option} -returnCodes error -body {
.t mark gravity
-} -returnCodes error -result {wrong # args: should be ".t mark gravity markName ?gravity?"}
-
+} -result {wrong # args: should be ".t mark gravity markName ?gravity?"}
-test textMark-2.1 {TkTextMarkCmd - "names" option} -constraints {
- haveCourier12
-} -body {
+test textMark-2.1 {TkTextMarkCmd - "names" option} -body {
.t mark names 2
} -returnCodes error -result {wrong # args: should be ".t mark names"}
-test textMark-2.2 {TkTextMarkCmd - "names" option} -constraints {
- haveCourier12
-} -setup {
+test textMark-2.2 {TkTextMarkCmd - "names" option} -setup {
.t mark unset {*}[.t mark names]
} -body {
lsort [.t mark na]
} -result {current insert}
-test textMark-2.3 {TkTextMarkCmd - "names" option} -constraints {
- haveCourier12
-} -setup {
+test textMark-2.3 {TkTextMarkCmd - "names" option} -setup {
.t mark unset {*}[.t mark names]
} -body {
.t mark set a 1.1
@@ -116,81 +87,55 @@ test textMark-2.3 {TkTextMarkCmd - "names" option} -constraints {
lsort [.t mark names]
} -result {a {b c} current insert}
-
-test textMark-3.1 {TkTextMarkCmd - "set" option} -constraints {
- haveCourier12
-} -body {
+test textMark-3.1 {TkTextMarkCmd - "set" option} -returnCodes error -body {
.t mark set a
-} -returnCodes error -result {wrong # args: should be ".t mark set markName index"}
-test textMark-3.2 {TkTextMarkCmd - "set" option} -constraints {
- haveCourier12
-} -body {
+} -result {wrong # args: should be ".t mark set markName index"}
+test textMark-3.2 {TkTextMarkCmd - "set" option} -returnCodes error -body {
.t mark s a b c
-} -returnCodes error -result {wrong # args: should be ".t mark set markName index"}
-test textMark-3.3 {TkTextMarkCmd - "set" option} -constraints {
- haveCourier12
-} -body {
+} -result {wrong # args: should be ".t mark set markName index"}
+test textMark-3.3 {TkTextMarkCmd - "set" option} -body {
.t mark set a @x
} -returnCodes error -result {bad text index "@x"}
-test textMark-3.4 {TkTextMarkCmd - "set" option} -constraints {
- haveCourier12
-} -body {
+test textMark-3.4 {TkTextMarkCmd - "set" option} -body {
.t mark set a 1.2
.t index a
} -result 1.2
-test textMark-3.5 {TkTextMarkCmd - "set" option} -constraints {
- haveCourier12
-} -body {
+test textMark-3.5 {TkTextMarkCmd - "set" option} -body {
.t mark set a end
.t index a
} -result {8.0}
-
-test textMark-4.1 {TkTextMarkCmd - "unset" option} -constraints {
- haveCourier12
-} -body {
+test textMark-4.1 {TkTextMarkCmd - "unset" option} -body {
.t mark unset
-} -returnCodes ok -result {}
-test textMark-4.2 {TkTextMarkCmd - "unset" option} -constraints {
- haveCourier12
-} -body {
+} -result {}
+test textMark-4.2 {TkTextMarkCmd - "unset" option} -body {
.t mark set a 1.2
.t mark set b 2.3
.t mark unset a b
.t index a
} -returnCodes error -result {bad text index "a"}
-test textMark-4.2 {TkTextMarkCmd - "unset" option} -constraints {
- haveCourier12
-} -body {
+test textMark-4.2 {TkTextMarkCmd - "unset" option} -body {
.t mark set a 1.2
.t mark set b 2.3
.t mark unset a b
.t index b
} -returnCodes error -result {bad text index "b"}
-test textMark-4.3 {TkTextMarkCmd - "unset" option} -constraints {
- haveCourier12
-} -body {
+test textMark-4.3 {TkTextMarkCmd - "unset" option} -body {
.t mark set a 1.2
.t mark set b 2.3
.t mark set 49ers 3.1
- eval .t mark unset [.t mark names]
+ .t mark unset {*}[.t mark names]
lsort [.t mark names]
} -result {current insert}
-
-test textMark-5.1 {TkTextMarkCmd - miscellaneous} -constraints {
- haveCourier12
-} -body {
+test textMark-5.1 {TkTextMarkCmd - miscellaneous} -returnCodes error -body {
.t mark
-} -returnCodes error -result {wrong # args: should be ".t mark option ?arg ...?"}
-test textMark-5.2 {TkTextMarkCmd - miscellaneous} -constraints {
- haveCourier12
-} -body {
+} -result {wrong # args: should be ".t mark option ?arg ...?"}
+test textMark-5.2 {TkTextMarkCmd - miscellaneous} -returnCodes error -body {
.t mark foo
-} -returnCodes error -result {bad mark option "foo": must be gravity, names, next, previous, set, or unset}
+} -result {bad mark option "foo": must be gravity, names, next, previous, set, or unset}
-
-test textMark-6.1 {TkTextMarkSegToIndex} -constraints haveCourier12 -body {
+test textMark-6.1 {TkTextMarkSegToIndex} -body {
.t mark set a 1.2
.t mark set b 1.2
.t mark set c 1.2
@@ -198,64 +143,47 @@ test textMark-6.1 {TkTextMarkSegToIndex} -constraints haveCourier12 -body {
list [.t index a] [.t index b] [.t index c ] [.t index d]
} -result {1.2 1.2 1.2 1.4}
-
-test textMark-7.1 {MarkFindNext - invalid mark name} -constraints {
- haveCourier12
-} -body {
+test textMark-7.1 {MarkFindNext - invalid mark name} -body {
.t mark next bogus
} -returnCodes error -result {bad text index "bogus"}
-test textMark-7.2 {MarkFindNext - marks at same location} -constraints {
- haveCourier12
-} -body {
+test textMark-7.2 {MarkFindNext - marks at same location} -body {
.t mark set insert 2.0
.t mark set current 2.0
.t mark next current
} -result {insert}
-test textMark-7.3 {MarkFindNext - numerical starting mark} -constraints {
- haveCourier12
-} -body {
+test textMark-7.3 {MarkFindNext - numerical starting mark} -body {
.t mark set current 1.0
.t mark set insert 1.0
.t mark next 1.0
} -result {insert}
-test textMark-7.4 {MarkFindNext - mark on the same line} -constraints {
- haveCourier12
-} -setup {
+test textMark-7.4 {MarkFindNext - mark on the same line} -setup {
.t mark unset {*}[.t mark names]
} -body {
.t mark set current 1.0
.t mark set insert 1.1
.t mark next current
} -result {insert}
-test textMark-7.5 {MarkFindNext - mark on the next line} -constraints {
- haveCourier12
-} -setup {
+test textMark-7.5 {MarkFindNext - mark on the next line} -setup {
.t mark unset {*}[.t mark names]
} -body {
.t mark set current 1.end
.t mark set insert 2.0
.t mark next current
} -result {insert}
-test textMark-7.6 {MarkFindNext - mark far away} -constraints {
- haveCourier12
-} -setup {
+test textMark-7.6 {MarkFindNext - mark far away} -setup {
.t mark unset {*}[.t mark names]
} -body {
.t mark set current 1.2
.t mark set insert 7.0
.t mark next current
} -result {insert}
-test textMark-7.7 {MarkFindNext - mark on top of end} -constraints {
- haveCourier12
-} -setup {
+test textMark-7.7 {MarkFindNext - mark on top of end} -setup {
.t mark unset {*}[.t mark names]
} -body {
.t mark set current end
.t mark next end
} -result {current}
-test textMark-7.8 {MarkFindNext - no next mark} -constraints {
- haveCourier12
-} -setup {
+test textMark-7.8 {MarkFindNext - no next mark} -setup {
.t mark unset {*}[.t mark names]
} -body {
.t mark set current 1.0
@@ -263,77 +191,63 @@ test textMark-7.8 {MarkFindNext - no next mark} -constraints {
.t mark next insert
} -result {}
-
-test textMark-8.1 {MarkFindPrev - invalid mark name} -constraints {
- haveCourier12
-} -body {
+test textMark-8.1 {MarkFindPrev - invalid mark name} -body {
.t mark prev bogus
} -returnCodes error -result {bad text index "bogus"}
-test textMark-8.2 {MarkFindPrev - marks at same location} -constraints {
- haveCourier12
-} -body {
+test textMark-8.2 {MarkFindPrev - marks at same location} -body {
.t mark set insert 2.0
.t mark set current 2.0
.t mark prev insert
} -result {current}
-test textMark-8.3 {MarkFindPrev - numerical starting mark} -constraints {
- haveCourier12
-} -setup {
+test textMark-8.3 {MarkFindPrev - numerical starting mark} -setup {
.t mark unset {*}[.t mark names]
} -body {
.t mark set current 1.0
.t mark set insert 1.0
.t mark prev 1.1
} -result {current}
-test textMark-8.4 {MarkFindPrev - mark on the same line} -constraints {
- haveCourier12
-} -setup {
+test textMark-8.4 {MarkFindPrev - mark on the same line} -setup {
.t mark unset {*}[.t mark names]
} -body {
.t mark set current 1.0
.t mark set insert 1.1
.t mark prev insert
} -result {current}
-test textMark-8.5 {MarkFindPrev - mark on the previous line} -constraints {
- haveCourier12
-} -setup {
+test textMark-8.5 {MarkFindPrev - mark on the previous line} -setup {
.t mark unset {*}[.t mark names]
} -body {
.t mark set current 1.end
.t mark set insert 2.0
.t mark prev insert
} -result {current}
-test textMark-8.6 {MarkFindPrev - mark far away} -constraints {
- haveCourier12
-} -setup {
+test textMark-8.6 {MarkFindPrev - mark far away} -setup {
.t mark unset {*}[.t mark names]
} -body {
.t mark set current 1.2
.t mark set insert 7.0
.t mark prev insert
} -result {current}
-test textMark-8.7 {MarkFindPrev - mark on top of end} -constraints {
- haveCourier12
-} -setup {
+test textMark-8.7 {MarkFindPrev - mark on top of end} -setup {
.t mark unset {*}[.t mark names]
} -body {
.t mark set insert 3.0
.t mark set current end
.t mark prev end
} -result {insert}
-test textMark-8.8 {MarkFindPrev - no previous mark} -constraints {
- haveCourier12
-} -setup {
+test textMark-8.8 {MarkFindPrev - no previous mark} -setup {
.t mark unset {*}[.t mark names]
} -body {
.t mark set current 1.0
.t mark set insert 3.0
.t mark prev current
} -result {}
-
+
destroy .t
# cleanup
cleanupTests
return
+# Local Variables:
+# mode: tcl
+# End: