diff options
Diffstat (limited to 'tests/tcltests.tcl')
-rw-r--r-- | tests/tcltests.tcl | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/tcltests.tcl b/tests/tcltests.tcl new file mode 100644 index 0000000..193ba0a --- /dev/null +++ b/tests/tcltests.tcl @@ -0,0 +1,46 @@ +#! /usr/bin/env tclsh + +package require tcltest 2.5 +namespace import ::tcltest::* +testConstraint exec [llength [info commands exec]] +testConstraint fcopy [llength [info commands fcopy]] +testConstraint fileevent [llength [info commands fileevent]] +testConstraint thread [ + expr {0 == [catch {package require Thread 2.7-}]}] +testConstraint notValgrind [expr {![testConstraint valgrind]}] + + +namespace eval ::tcltests { + + + proc init {} { + if {[namespace which ::tcl::file::tempdir] eq {}} { + interp alias {} [namespace current]::tempdir {} [ + namespace current]::tempdir_alternate + } else { + interp alias {} [namespace current]::tempdir {} ::tcl::file::tempdir + } + } + + + proc tempdir_alternate {} { + close [file tempfile tempfile] + set tmpdir [file dirname $tempfile] + set execname [info nameofexecutable] + regsub -all {[^[:alpha:][:digit:]]} $execname _ execname + for {set i 0} {$i < 10000} {incr i} { + set time [clock milliseconds] + set name $tmpdir/${execname}_${time}_$i + if {![file exists $name]} { + file mkdir $name + return $name + } + } + error [list {could not create temporary directory}] + } + + init + + package provide tcltests 0.1 +} + |