# -*- 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. # # ------------------------------------------------------------------------- source [file join \ [file dirname [file dirname [file join [pwd] [info script]]]] \ devtools testutilities.tcl] testsNeedTcl 8.2 testsNeedTcltest 1.0 support { useLocal string.tcl textutil::string useLocal repeat.tcl textutil::repeat useLocal adjust.tcl textutil::adjust useLocal split.tcl textutil::split useLocal tabify.tcl textutil::tabify useLocal trim.tcl textutil::trim } testing { useLocalKeep textutil.tcl textutil } # ------------------------------------------------------------------------- test textutil-1.0 {blank -1} { textutil::blank -1 } {} test textutil-1.1 {blank 0} { textutil::blank 0 } {} test textutil-1.2 {blank 1} { textutil::blank 1 } { } test textutil-1.3 {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} testsuiteCleanup