os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/split.test
Update contrib.
1 # Commands covered: split
3 # This file contains a collection of tests for one or more of the Tcl
4 # built-in commands. Sourcing this file into Tcl runs the tests and
5 # generates output for errors. No output means no errors were found.
7 # Copyright (c) 1991-1993 The Regents of the University of California.
8 # Copyright (c) 1994-1996 Sun Microsystems, Inc.
9 # Copyright (c) 1998-1999 by Scriptics Corporation.
11 # See the file "license.terms" for information on usage and redistribution
12 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
14 # RCS: @(#) $Id: split.test,v 1.8 2002/11/12 02:25:24 hobbs Exp $
16 if {[lsearch [namespace children] ::tcltest] == -1} {
17 package require tcltest
18 namespace import -force ::tcltest::*
21 test split-1.1 {basic split commands} {
22 split "a\n b\t\r c\n "
23 } {a {} b {} {} c {} {}}
24 test split-1.2 {basic split commands} {
25 split "word 1xyzword 2zword 3" xyz
26 } {{word 1} {} {} {word 2} {word 3}}
27 test split-1.3 {basic split commands} {
30 test split-1.4 {basic split commands} {
32 } "a\\}b\\\[c\\{\\\]\\\$"
33 test split-1.5 {basic split commands} {
36 test split-1.6 {basic split commands} {
39 test split-1.7 {basic split commands} {
42 test split-1.8 {basic split commands} {
45 foreach f [split {]\n} {}] {
52 test split-1.9 {basic split commands} {
60 test split-1.10 {basic split commands} {
61 split "a0ab1b2bbb3\000c4" ab\000c
62 } {{} 0 {} 1 2 {} {} 3 {} 4}
63 test split-1.11 {basic split commands} {
66 test split-1.12 {basic split commands} {
67 split "\u0001ab\u0001cd\u0001\u0001ef\u0001" \1
69 test split-1.13 {basic split commands} {
72 test split-1.14 {basic split commands} {
73 split ",12,,,34,56," {,}
74 } {{} 12 {} {} 34 56 {}}
76 test split-2.1 {split errors} {
77 list [catch split msg] $msg $errorCode
78 } {1 {wrong # args: should be "split string ?splitChars?"} NONE}
79 test split-2.2 {split errors} {
80 list [catch {split a b c} msg] $msg $errorCode
81 } {1 {wrong # args: should be "split string ?splitChars?"} NONE}
85 ::tcltest::cleanupTests