Import Tcl 8.6.12

This commit is contained in:
Steve Dower
2021-11-08 17:30:58 +00:00
parent 1aadb2455c
commit 674867e7e6
608 changed files with 78089 additions and 60360 deletions

View File

@@ -0,0 +1,17 @@
# all.tcl --
#
# This file contains a top-level script to run all of the Tcl
# tests. Execute it by invoking "source all.test" when running tcltest
# in this directory.
#
# Copyright (c) 1998-2000 by Scriptics Corporation.
# All rights reserved.
#
# RCS: @(#) $Id$
package require Tcl 8.5-
package require tcltest 2.2
::tcltest::configure \
-testdir [file dirname [file normalize [info script]]] \
{*}$argv
::tcltest::runAllTests

View File

@@ -0,0 +1,50 @@
# tdbc.test --
#
# Tests for convenience commands in TDBC
#
# Copyright (c) 2009 by Kevin B. Kenny.
#
# $Id: $
package require tcltest 2
namespace import -force ::tcltest::*
tcltest::loadTestedCommands
package require tdbc
test tdbc-1.1 {tdbc::mapSqlState, wrong args} {*}{
-body {
list [catch {tdbc::mapSqlState} result] $result
}
-match glob
-result {1 {wrong # args:*}}
}
test tdbc-1.2 {tdbc::mapSqlState, wrong args} {*}{
-body {
list [catch {tdbc::mapSqlState 00000 ?} result] $result
}
-match glob
-result {1 {wrong # args:*}}
}
test tdbc-1.3 {tdbc::mapSqlState, known state} {*}{
-body {
tdbc::mapSqlState 22012
}
-result {DATA_EXCEPTION}
}
test tdbc-1.4 {tdbc::mapSqlState, known state} {*}{
-body {
tdbc::mapSqlState *****
}
-result {UNKNOWN_SQLSTATE}
}
cleanupTests
return
# Local Variables:
# mode: tcl
# End:

View File

@@ -0,0 +1,69 @@
# tokenize.test --
#
# Tests for the tokenizer in TDBC
package require tcltest 2
namespace import -force ::tcltest::*
tcltest::loadTestedCommands
package require tdbc
test tokenize-1.0 {wrong args} \
-body {
::tdbc::tokenize
} \
-returnCodes error \
-result {wrong # args: should be "::tdbc::tokenize statement"}
test tokenize-1.1 {wrong args} \
-body {
::tdbc::tokenize foo bar
} \
-returnCodes error \
-result {wrong # args: should be "::tdbc::tokenize statement"}
test tokenize-2.0 {colon substitution, unquoted and quoted} {
::tdbc::tokenize {SELECT :a, ':b' FROM y}
} [list {SELECT } {:a} {, ':b' FROM y}]
test tokenize-2.1 {PostgreSQL cast syntax, not a colon substitution} {
::tdbc::tokenize {SELECT :foo::VARCHAR}
} [list {SELECT } :foo {::VARCHAR}]
test tokenize-3.0 {complex set of statements} {
::tdbc::tokenize {-- begin with a comment :hi;
SELECT :a, ':b', ":c", [:d], /* :e, */ :f FROM y;
INSERT INTO y VALUES(1,2,oracle$name,:g);}
} [list \
"-- begin with a comment :hi;\n\tSELECT " \
:a \
{, ':b', ":c", [:d], /* :e, */ } \
:f \
{ FROM y} \
\; \
"\n\tINSERT INTO y VALUES(1,2,oracle\$name," \
:g \
")" \
";"]
test tokenize-4.0 {unterminated comment} {
::tdbc::tokenize {-- unterminated comment}
} {{-- unterminated comment}}
test tokenize-4.1 {unterminated quote} {
::tdbc::tokenize {' unterminated quote}
} {{' unterminated quote}}
test tokenize-4.2 {unterminated quote} {
::tdbc::tokenize "\" unterminated quote"
} [list "\" unterminated quote"]
test tokenize-4.3 {unterminated quote} {
::tdbc::tokenize "\[ unterminated quote"
} [list "\[ unterminated quote"]
cleanupTests
return
# Local Variables:
# mode: tcl
# End: