os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/split.test
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/split.test	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,98 @@
     1.4 +# Commands covered:  split
     1.5 +#
     1.6 +# This file contains a collection of tests for one or more of the Tcl
     1.7 +# built-in commands.  Sourcing this file into Tcl runs the tests and
     1.8 +# generates output for errors.  No output means no errors were found.
     1.9 +#
    1.10 +# Copyright (c) 1991-1993 The Regents of the University of California.
    1.11 +# Copyright (c) 1994-1996 Sun Microsystems, Inc.
    1.12 +# Copyright (c) 1998-1999 by Scriptics Corporation.
    1.13 +#
    1.14 +# See the file "license.terms" for information on usage and redistribution
    1.15 +# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
    1.16 +#
    1.17 +# RCS: @(#) $Id: split.test,v 1.8 2002/11/12 02:25:24 hobbs Exp $
    1.18 +
    1.19 +if {[lsearch [namespace children] ::tcltest] == -1} {
    1.20 +    package require tcltest
    1.21 +    namespace import -force ::tcltest::*
    1.22 +}
    1.23 +
    1.24 +test split-1.1 {basic split commands} {
    1.25 +    split "a\n b\t\r c\n "
    1.26 +} {a {} b {} {} c {} {}}
    1.27 +test split-1.2 {basic split commands} {
    1.28 +    split "word 1xyzword 2zword 3" xyz
    1.29 +} {{word 1} {} {} {word 2} {word 3}}
    1.30 +test split-1.3 {basic split commands} {
    1.31 +    split "12345" {}
    1.32 +} {1 2 3 4 5}
    1.33 +test split-1.4 {basic split commands} {
    1.34 +    split "a\}b\[c\{\]\$"
    1.35 +} "a\\}b\\\[c\\{\\\]\\\$"
    1.36 +test split-1.5 {basic split commands} {
    1.37 +    split {} {}
    1.38 +} {}
    1.39 +test split-1.6 {basic split commands} {
    1.40 +    split {}
    1.41 +} {}
    1.42 +test split-1.7 {basic split commands} {
    1.43 +    split {   }
    1.44 +} {{} {} {} {}}
    1.45 +test split-1.8 {basic split commands} {
    1.46 +    proc foo {} {
    1.47 +        set x {}
    1.48 +        foreach f [split {]\n} {}] {
    1.49 +            append x $f
    1.50 +        }
    1.51 +        return $x	
    1.52 +    }
    1.53 +    foo
    1.54 +} {]\n}
    1.55 +test split-1.9 {basic split commands} {
    1.56 +    proc foo {} {
    1.57 +        set x ab\000c
    1.58 +        set y [split $x {}]
    1.59 +        return $y
    1.60 +    }
    1.61 +    foo
    1.62 +} "a b \000 c"
    1.63 +test split-1.10 {basic split commands} {
    1.64 +    split "a0ab1b2bbb3\000c4" ab\000c
    1.65 +} {{} 0 {} 1 2 {} {} 3 {} 4}
    1.66 +test split-1.11 {basic split commands} {
    1.67 +    split "12,3,45" {,}
    1.68 +} {12 3 45}
    1.69 +test split-1.12 {basic split commands} {
    1.70 +    split "\u0001ab\u0001cd\u0001\u0001ef\u0001" \1
    1.71 +} {{} ab cd {} ef {}}
    1.72 +test split-1.13 {basic split commands} {
    1.73 +    split "12,34,56," {,}
    1.74 +} {12 34 56 {}}
    1.75 +test split-1.14 {basic split commands} {
    1.76 +    split ",12,,,34,56," {,}
    1.77 +} {{} 12 {} {} 34 56 {}}
    1.78 +
    1.79 +test split-2.1 {split errors} {
    1.80 +    list [catch split msg] $msg $errorCode
    1.81 +} {1 {wrong # args: should be "split string ?splitChars?"} NONE}
    1.82 +test split-2.2 {split errors} {
    1.83 +    list [catch {split a b c} msg] $msg $errorCode
    1.84 +} {1 {wrong # args: should be "split string ?splitChars?"} NONE}
    1.85 +
    1.86 +# cleanup
    1.87 +catch {rename foo {}}
    1.88 +::tcltest::cleanupTests
    1.89 +return
    1.90 +
    1.91 +
    1.92 +
    1.93 +
    1.94 +
    1.95 +
    1.96 +
    1.97 +
    1.98 +
    1.99 +
   1.100 +
   1.101 +