###############################################################################
#
# tcl-errorInfo.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

source [file join [file normalize [file dirname [info script]]] prologue.eagle]

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

runTest {test tclErrorInfo-1.1 {unified errorInfo, Tcl error} -setup {
  unset -nocomplain interp
  set tcl_loaded 0
  if {![tcl ready]} then {tcl load; set tcl_loaded 1}
  set interp [tcl create]
} -body {
  set errorInfo ""
  catch {tcl eval $interp {error "this is a Tcl error."}}
  string map [list \r\n \n] $errorInfo
} -cleanup {
  if {[info exists interp]} then {tcl delete $interp}
  if {$tcl_loaded} then {tcl unload}
  unset -nocomplain tcl_loaded interp
} -constraints {eagle native dynamic tclLibrary command.tcl compile.NATIVE\
compile.TCL primaryThread} -result {this is a Tcl error.
    while executing
"error "this is a Tcl error.""
    ("tcl eval" body line 1)
    invoked from within
"tcl eval $interp {error "this is a Tcl error."}"
    ("catch" body line 1)}}

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

runTest {test tclErrorInfo-1.2 {unified errorInfo, Eagle error} -setup {
  unset -nocomplain interp
  set tcl_loaded 0
  if {![tcl ready]} then {tcl load; set tcl_loaded 1}
  set interp [tcl create]
} -body {
  set errorInfo ""
  catch {tcl eval $interp {eagle {error "this is an Eagle error."}}}
  string map [list \r\n \n] $errorInfo
} -cleanup {
  if {[info exists interp]} then {tcl delete $interp}
  if {$tcl_loaded} then {tcl unload}
  unset -nocomplain tcl_loaded interp
} -constraints {eagle native dynamic tclLibrary command.tcl compile.NATIVE\
compile.TCL primaryThread} -result {this is an Eagle error.
    while executing
"error "this is an Eagle error.""
    ("eval" body line 1)
this is an Eagle error.
    while executing
"eagle {error "this is an Eagle error."}"
    ("tcl eval" body line 1)
    invoked from within
"tcl eval $interp {eagle {error "this is an Eagle error."}}"
    ("catch" body line 1)}}

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

source [file join [file normalize [file dirname [info script]]] epilogue.eagle]
