Import Tcl 8.6.11

This commit is contained in:
Steve Dower
2021-03-30 00:51:39 +01:00
parent 3bb8e3e086
commit 1aadb2455c
923 changed files with 79104 additions and 62616 deletions

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: