System.Data.SQLite
Artifact Content
Not logged in

Artifact 98667176084623bd67290e7ab3a71880409dccee:


###############################################################################
#
# tkt-ac47dd230a.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-ac47dd230a-1.1 {multiple AppDomains} -setup {
  for {set i 1} {$i < 3} {incr i} {
    set appDomain($i) [object invoke AppDomain CreateDomain \
        [appendArgs tkt-ac47dd230a-1.1. $i]]

    set interpreterSettings($i) [object invoke -alias InterpreterSettings \
        Create]

    $interpreterSettings($i) CreateFlags Default
    $interpreterSettings($i) InitializeFlags Default
    $interpreterSettings($i) ScriptFlags Default

    set result null
    set interpreterHelper($i) [object invoke -alias InterpreterHelper \
        Create $appDomain($i) $interpreterSettings($i) true result]

    if {[string length $interpreterHelper($i)] == 0} then {
      error [object invoke $result ToString]
    }

    set interpreter($i) [$interpreterHelper($i) -alias Interpreter]

    set result null
    set code [$interpreter($i) EvaluateScript [getAppDomainPreamble] result]

    if {$code ne "Ok"} then {
      error [object invoke $result ToString]
    }
  }
} -body {
  set results [list]

  for {set i 1} {$i < 3} {incr i} {
    set result null
    set code [$interpreter($i) EvaluateScript {
      package require Eagle.Library
      package require Eagle.Test
      package require System.Data.SQLite.Test

      object load -loadtype File [file join [getBinaryDirectory] \
          System.Data.SQLite.dll]

      setupDb tkt-ac47dd230a-1.1; cleanupDb tkt-ac47dd230a-1.1
    } result]

    lappend results $code [expr {[string length $result] > 0 ? \
        [object invoke $result ToString] : ""}]
  }

  set results
} -cleanup {
  unset -nocomplain results code result interpreter interpreterHelper \
      interpreterSettings

  for {set i 1} {$i < 3} {incr i} {
    if {[info exists appDomain($i)]} then {
      object invoke AppDomain Unload $appDomain($i)
    }
  }

  unset -nocomplain appDomain i
} -constraints {eagle command.object monoBug28 command.sql compile.DATA\
compile.ISOLATED_INTERPRETERS SQLite System.Data.SQLite} -result {Ok 0 Ok 0}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue