File: textutil.test

package info (click to toggle)
tcllib 1.8-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 13,628 kB
  • ctags: 4,897
  • sloc: tcl: 88,012; sh: 7,856; ansic: 4,174; xml: 1,765; yacc: 753; perl: 84; f90: 84; makefile: 60; python: 33; ruby: 13; php: 11
file content (131 lines) | stat: -rw-r--r-- 2,643 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# -*- tcl -*-
# textutil.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.
#

if {[lsearch [namespace children] ::tcltest] == -1} {
    package require tcltest
    namespace import ::tcltest::*
}	

#source [ file join [ file dirname [ info script ] ] [ file rootname [ file tail [ info script ] ] ].tcl ]
#source [ file join [ file dirname [ info script ] ] adjust.test ]
#source [ file join [ file dirname [ info script ] ] split.test ]
#source [ file join [ file dirname [ info script ] ] tabify.test ]
#source [ file join [ file dirname [ info script ] ] trim.test ]
#source [ file join [ file dirname [ info script ] ] repeat.test ]


test textutil-1.0 {blank -1} {
    textutil::blank -1
} {}

test textutil-1.0 {blank 0} {
    textutil::blank 0
} {}

test textutil-1.0 {blank 1} {
    textutil::blank 1
} { }

test textutil-1.0 {blank 10} {
    textutil::blank 10
} {          }



test textutil-2.0 {chop empty} {
    textutil::chop {}
} {}

test textutil-2.1 {chop single} {
    textutil::chop { }
} {}

test textutil-2.2 {chop long} {
    textutil::chop {abcde}
} {abcd}



test textutil-3.0 {tail empty} {
    textutil::tail {}
} {}

test textutil-3.1 {tail single} {
    textutil::tail { }
} {}

test textutil-3.2 {tail long} {
    textutil::tail {abcde}
} {bcde}



test textutil-4.0 {cap empty} {
    textutil::cap {}
} {}

test textutil-4.1 {cap single} {
    textutil::cap {a}
} {A}

test textutil-4.2 {cap long} {
    textutil::cap {abcde}
} {Abcde}

test textutil-4.3 {cap capped} {
    textutil::cap {Abcde}
} {Abcde}



test textutil-5.0 {uncap empty} {
    textutil::uncap {}
} {}

test textutil-5.1 {uncap single} {
    textutil::uncap {A}
} {a}

test textutil-5.2 {uncap long} {
    textutil::uncap {Abcde}
} {abcde}

test textutil-5.3 {uncap uncapped} {
    textutil::uncap {abcde}
} {abcde}



test textutil-6.0 {lcs, no strings} {
    textutil::longestCommonPrefixList {}
} {}

test textutil-6.1 {lcs, one string} {
    textutil::longestCommonPrefixList {foo}
} {foo}

test textutil-6.2 {lcs, two strings, no prefix} {
    textutil::longestCommonPrefixList {foo bar}
} {}

test textutil-6.3 {lcs, two strings, small prefix} {
    textutil::longestCommonPrefixList {foo fbar}
} {f}

test textutil-6.4 {lcs, two strings, common} {
    textutil::longestCommonPrefixList {foo foo}
} {foo}

test textutil-6.5 {lcs, multiple strings} {
    textutil::longestCommonPrefixList {foo fox fubar}
} {f}




::tcltest::cleanupTests