Artifact
46990c6357a5e1ede3a80b313a13fd5f677cd64a:
- File
Tests/common.eagle
— part of check-in
[11f11f0c83]
at
2011-07-05 04:40:13
on branch trunk
— Add tests for ticket [448d663d11]. Further refinements to unit testing infrastructure.
(user:
mistachkin
size: 1428)
###############################################################################
#
# common.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################
if {[isEagle]} then {
proc loadAssembly { fileName } {
set fileName [file join [file dirname $::path] bin \
[expr {[haveConstraint imageRuntime40] ? "2010" : "2008"}] \
$::test_configuration bin $fileName]
if {[catch {set assembly \
[object load -loadtype File $fileName]}] == 0} then {
#
# NOTE: Now, add the necessary test constraint.
#
addConstraint [file rootname [file tail $fileName]]
#
# NOTE: Return the full path of the loaded file.
#
return $fileName
}
return ""
}
proc setupDb {fileName {mode ""} {varName db}} {
set fileName [file join [getTemporaryPath] $fileName]
catch {file delete $fileName}
upvar 1 $varName db
set connection {Data Source=${fileName}}
if {[string length $mode] > 0} then {
append connection {;Journal Mode=${mode}}
}
set db [sql open -type SQLite [subst $connection]]
}
proc cleanupDb {fileName {varName db}} {
upvar 1 $varName db
catch {sql close $db}
catch {file delete [file join [getTemporaryPath] $fileName]}
}
}