diff options
Diffstat (limited to 'tcllib/modules/textutil/repeat.test')
-rw-r--r-- | tcllib/modules/textutil/repeat.test | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/tcllib/modules/textutil/repeat.test b/tcllib/modules/textutil/repeat.test new file mode 100644 index 0000000..5427b84 --- /dev/null +++ b/tcllib/modules/textutil/repeat.test @@ -0,0 +1,62 @@ +# -*- tcl -*- +# trim.test: tests for the textutil package. +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# + +# ------------------------------------------------------------------------- + +source [file join \ + [file dirname [file dirname [file join [pwd] [info script]]]] \ + devtools testutilities.tcl] + +testsNeedTcl 8.2 +testsNeedTcltest 1.0 + +testing { + useLocal repeat.tcl textutil::repeat +} + +# ------------------------------------------------------------------------- + +test rep-0.1 {repeat < 0} { + set str [::textutil::repeat::strRepeat . -1] + set str +} "" + +test rep-0.2 {repeat 0} { + set str [::textutil::repeat::strRepeat . 0] + set str +} "" + +test rep-0.3 {repeat 1} { + set str [::textutil::repeat::strRepeat . 1] + set str +} "." + +test rep-0.4 {repeat 2} { + set str [::textutil::repeat::strRepeat . 2] + set str +} ".." + +test rep-0.5 {repeat 3} { + set str [::textutil::repeat::strRepeat . 3] + set str +} "..." + +test rep-0.6 {repeat 5} { + set str [::textutil::repeat::strRepeat . 5] + set str +} "....." + +test rep-0.7 {repeat 10} { + set str [::textutil::repeat::strRepeat . 10] + set str +} ".........." + +test rep-0.8 {repeat 100} { + set str [::textutil::repeat::strRepeat . 100] + set str +} "...................................................................................................." |