subst.test
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:9k
- # Commands covered: subst
- #
- # 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.
- #
- # Copyright (c) 1994 The Regents of the University of California.
- # Copyright (c) 1994 Sun Microsystems, Inc.
- # Copyright (c) 1998-2000 Ajuba Solutions.
- #
- # See the file "license.terms" for information on usage and redistribution
- # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- #
- # RCS: @(#) $Id: subst.test,v 1.13.2.7 2004/10/26 21:42:53 dgp Exp $
- if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
- namespace import -force ::tcltest::*
- }
- test subst-1.1 {basics} {
- list [catch {subst} msg] $msg
- } {1 {wrong # args: should be "subst ?-nobackslashes? ?-nocommands? ?-novariables? string"}}
- test subst-1.2 {basics} {
- list [catch {subst a b c} msg] $msg
- } {1 {bad switch "a": must be -nobackslashes, -nocommands, or -novariables}}
- test subst-2.1 {simple strings} {
- subst {}
- } {}
- test subst-2.2 {simple strings} {
- subst a
- } a
- test subst-2.3 {simple strings} {
- subst abcdefg
- } abcdefg
- test subst-2.4 {simple strings} {
- # Tcl Bug 685106
- subst [bytestring barx00soom]
- } [bytestring barx00soom]
- test subst-3.1 {backslash substitutions} {
- subst {x$x[foo bar]\}
- } "x$x[foo bar]\"
- test subst-3.2 {backslash substitutions with utf chars} {
- # 'j' is just a char that doesn't mean anything, and 344 is '