diff options
Diffstat (limited to 'tests/defs')
-rw-r--r-- | tests/defs | 44 |
1 files changed, 24 insertions, 20 deletions
@@ -5,16 +5,17 @@ # # Copyright (c) 1990-1994 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. +# Copyright (c) 1998 by Scriptics Corporation # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: defs,v 1.4 1998/11/02 23:04:13 stanton Exp $ +# RCS: @(#) $Id: defs,v 1.5 1998/12/04 04:18:20 hershey Exp $ -if ![info exists VERBOSE] { +if {![info exists VERBOSE]} { set VERBOSE 0 } -if ![info exists TESTS] { +if {![info exists TESTS]} { set TESTS {} } @@ -113,11 +114,11 @@ if {$tcl_platform(platform) == "windows"} { } else { set testConfig(pcOnly) 0 } -set testConfig(unixOrPc) [expr $testConfig(unixOnly) || $testConfig(pcOnly)] -set testConfig(macOrPc) [expr $testConfig(macOnly) || $testConfig(pcOnly)] -set testConfig(macOrUnix) [expr $testConfig(macOnly) || $testConfig(unixOnly)] -set testConfig(nonPortable) [expr [file exists doAllTests] || [file exists doAllTe]] -set testConfig(knownBug) [expr [file exists doBuggyTests] || [file exists doBuggyT]] +set testConfig(unixOrPc) [expr {$testConfig(unixOnly) || $testConfig(pcOnly)}] +set testConfig(macOrPc) [expr {$testConfig(macOnly) || $testConfig(pcOnly)}] +set testConfig(macOrUnix) [expr {$testConfig(macOnly) || $testConfig(unixOnly)}] +set testConfig(nonPortable) [expr {[file exists doAllTests] || [file exists doAllTe]}] +set testConfig(knownBug) [expr {[file exists doBuggyTests] || [file exists doBuggyT]}] set testConfig(notIfCompiled) [file exists doAllCompilerTests] set testConfig(unix) $testConfig(unixOnly) @@ -139,7 +140,7 @@ set testConfig(unixCrash) $testConfig(macOrPc) if {[catch {set f [open defs r]}]} { set testConfig(nonBlockFiles) 1 } else { - if {[expr [catch {fconfigure $f -blocking off}]] == 0} { + if {[catch {fconfigure $f -blocking off}] == 0} { set testConfig(nonBlockFiles) 1 } else { set testConfig(nonBlockFiles) 0 @@ -176,7 +177,7 @@ if {$tcl_platform(platform) == "unix"} { set testConfig(eformat) 1 if {[string compare "[format %g 5e-5]" "5e-05"] != 0} { set testConfig(eformat) 0 - puts "(will skip tests that depend on the \"e\" format of floating-point numbers)" + puts stdout "(will skip tests that depend on the \"e\" format of floating-point numbers)" } # Test to see if execed commands such as cat, echo, rm and so forth are # present on this machine. @@ -288,15 +289,18 @@ proc print_verbose {name description constraints script code answer} { proc test {name description script answer args} { global VERBOSE TESTS testConfig - if {[string compare $TESTS ""] != 0} then { + + if {[string compare $TESTS ""] != 0} { set ok 0 foreach test $TESTS { - if [string match $test $name] then { + if {[string match $test $name]} { set ok 1 break } } - if !$ok then return + if {!$ok} { + return + } } set i [llength $args] if {$i == 0} { @@ -332,7 +336,7 @@ proc test {name description script answer args} { } } if {$doTest == 0} { - if $VERBOSE then { + if {$VERBOSE} { puts stdout "++++ $name SKIPPED: $constraints" } return @@ -345,8 +349,8 @@ proc test {name description script answer args} { if {$code != 0} { print_verbose $name $description $constraints $script \ $code $result - } elseif {[string compare $result $answer] == 0} then { - if $VERBOSE then { + } elseif {[string compare $result $answer] == 0} { + if {$VERBOSE} { if {$VERBOSE > 0} { print_verbose $name $description $constraints $script \ $code $result @@ -382,7 +386,7 @@ proc normalizeMsg {msg} { proc makeFile {contents name} { set fd [open $name w] fconfigure $fd -translation lf - if {[string index $contents [expr [string length $contents] - 1]] == "\n"} { + if {[string index $contents [expr {[string length $contents] - 1}]] == "\n"} { puts -nonewline $fd $contents } else { puts $fd $contents @@ -421,7 +425,7 @@ set tcltest [info nameofexecutable] if {$tcltest == "{}"} { set tcltest {} - puts "Unable to find tcltest executable, multiple process tests will fail." + puts stdout "Unable to find tcltest executable, multiple process tests will fail." } if {$tcl_platform(os) != "Win32s"} { @@ -443,14 +447,14 @@ if {$tcl_platform(os) != "Win32s"} { } if {($tcl_platform(platform) == "windows") && ($testConfig(stdio) == 0)} { - puts "(will skip tests that redirect stdio of exec'd 32-bit applications)" + puts stdout "(will skip tests that redirect stdio of exec'd 32-bit applications)" } catch {socket} msg set testConfig(socket) [expr {$msg != "sockets are not available on this system"}] if {$testConfig(socket) == 0} { - puts "(will skip tests that use sockets)" + puts stdout "(will skip tests that use sockets)" } |