# # Copyright (c) 2011 D. Richard Hipp # # This program is free software; you can redistribute it and/or # modify it under the terms of the Simplified BSD License (also # known as the "2-Clause License" or "FreeBSD License".) # # This program is distributed in the hope that it will be useful, # but without any warranty; without even the implied warranty of # merchantability or fitness for a particular purpose. # # Author contact information: # drh@hwaci.com # http://www.hwaci.com/drh/ # ############################################################################ # # TH1/Tcl integration # set dir [file dirname [info script]] ############################################################################### fossil test-th-eval "hasfeature tcl" if {$::RESULT ne "1"} then { puts "Fossil was not compiled with Tcl support."; return } ############################################################################### set env(TH1_ENABLE_TCL) 1; # Tcl integration must be enabled for this test. ############################################################################### fossil test-th-render --th-open-config \ [file nativename [file join $dir th1-tcl1.txt]] test th1-tcl-1 {[regexp -- {^tclReady\(before\) = 0 tclReady\(after\) = 1 \d+ \d+ \d+ via Tcl invoke 4 4 two words one_word three words now \d+ two words 4 \d+ two words 4 \d+ one_word three words now $} [string map [list \r\n \n] $RESULT]]} ############################################################################### fossil test-th-render --th-open-config \ [file nativename [file join $dir th1-tcl2.txt]] test th1-tcl-2 {[regexp -- {^\d+ $} [string map [list \r\n \n] $RESULT]]} ############################################################################### fossil test-th-render --th-open-config \ [file nativename [file join $dir th1-tcl3.txt]] test th1-tcl-3 {$RESULT eq {

ERROR:\ invalid command name "bad_command"

}} ############################################################################### fossil test-th-render --th-open-config \ [file nativename [file join $dir th1-tcl4.txt]] test th1-tcl-4 {$RESULT eq {

ERROR:\ divide by zero

}} ############################################################################### fossil test-th-render --th-open-config \ [file nativename [file join $dir th1-tcl5.txt]] test th1-tcl-5 {$RESULT eq {

ERROR:\ Tcl command not found: bad_command

} || $RESULT eq {
ERROR: invalid command name "bad_command"

}} ############################################################################### fossil test-th-render --th-open-config \ [file nativename [file join $dir th1-tcl6.txt]] test th1-tcl-6 {$RESULT eq {

ERROR:\ no such command: bad_command

}} ############################################################################### fossil test-th-render --th-open-config \ [file nativename [file join $dir th1-tcl7.txt]] test th1-tcl-7 {$RESULT eq {

ERROR:\ syntax error in expression: "2**0"

}} ############################################################################### fossil test-th-render --th-open-config \ [file nativename [file join $dir th1-tcl8.txt]] test th1-tcl-8 {$RESULT eq {

ERROR:\ cannot invoke Tcl command: tailcall

} || $RESULT eq {
ERROR: tailcall can only be called from a proc or\ lambda

} || $RESULT eq {

ERROR: This test\ requires Tcl 8.6 or higher.

}} ############################################################################### fossil test-th-render --th-open-config \ [file nativename [file join $dir th1-tcl9.txt]] test th1-tcl-9 {[string trim $RESULT] eq [list [file tail $fossilexe] 3 \ [list test-th-render --th-open-config [file nativename [file join $dir \ th1-tcl9.txt]]]]}