summaryrefslogtreecommitdiffstats
path: root/tcllib/modules/textutil/repeat.test
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2016-10-27 19:39:39 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2016-10-27 19:39:39 (GMT)
commitea28451286d3ea4a772fa174483f9a7a66bb1ab3 (patch)
tree6ee9d8a7848333a7ceeee3b13d492e40225f8b86 /tcllib/modules/textutil/repeat.test
parentb5ca09bae0d6a1edce939eea03594dd56383f2c8 (diff)
parent7c621da28f07e449ad90c387344f07a453927569 (diff)
downloadblt-ea28451286d3ea4a772fa174483f9a7a66bb1ab3.zip
blt-ea28451286d3ea4a772fa174483f9a7a66bb1ab3.tar.gz
blt-ea28451286d3ea4a772fa174483f9a7a66bb1ab3.tar.bz2
Merge commit '7c621da28f07e449ad90c387344f07a453927569' as 'tcllib'
Diffstat (limited to 'tcllib/modules/textutil/repeat.test')
-rw-r--r--tcllib/modules/textutil/repeat.test62
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
+} "...................................................................................................."