###############################################################################
#
# tcl-subst.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 tclSubst-1.1 {Tcl substitution} -setup {
  unset -nocomplain interp
  set tcl_loaded 0
  if {![tcl ready]} then {tcl load; set tcl_loaded 1}
  set interp [tcl create]
} -body {
  set x {\n this is a test. $env(PATH) \n [pid]}
  list [tcl subst $interp x] [tcl subst -nobackslashes $interp x] \
      [tcl subst -nobackslashes $interp $x] [tcl subst $interp $x]
} -cleanup {
  if {[info exists interp]} then {tcl delete $interp}
  if {$tcl_loaded} then {tcl unload}
  unset -nocomplain tcl_loaded interp x
} -constraints \
{eagle native dynamic tclLibrary command.tcl compile.NATIVE compile.TCL\
primaryThread} \
-result [string map [list \r\n \n] \
[list x x "\\n this is a test. $env(PATH) \\n [pid]" "
 this is a test. $env(PATH) 
 [pid]"]]}

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

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