Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Work on minimal test cases for ticket [7e3fa93744]. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | tkt-7e3fa93744 |
Files: | files | file ages | folders |
SHA1: |
c243b1a5009f6cfd52869c9fc84d26ba |
User & Date: | mistachkin 2011-11-12 08:38:57.048 |
Context
2011-11-13
| ||
01:06 | Improve comments in the vendor specific interpreter initialization file. check-in: eb89cff67e user: mistachkin tags: tkt-7e3fa93744 | |
2011-11-12
| ||
08:38 | Work on minimal test cases for ticket [7e3fa93744]. check-in: c243b1a500 user: mistachkin tags: tkt-7e3fa93744 | |
07:05 | Modify unit test infrastructure to better support running test files that exist outside the source tree. check-in: 176935a5e1 user: mistachkin tags: trunk | |
Changes
Added Tests/tkt-7e3fa93744.eagle.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | ############################################################################### # # tkt-7e3fa93744.eagle -- # # Written by Joe Mistachkin. # Released to the public domain, use at your own risk! # ############################################################################### package require Eagle package require EagleLibrary package require EagleTest runTestPrologue ############################################################################### package require System.Data.SQLite.Test runSQLiteTestPrologue ############################################################################### runTest {test tkt-7e3fa93744-1.1 {composite primary key} -setup { setupDb [set fileName tkt-7e3fa93744-1.1.db] } -body { set sql { CREATE TABLE t1 ( id1 INTEGER PRIMARY KEY ); CREATE TABLE t2 ( id1 INTEGER NOT NULL, id2 INTEGER NOT NULL, PRIMARY KEY (id1, id2) ); INSERT INTO t1 (id1) VALUES (1); INSERT INTO t1 (id1) VALUES (2); INSERT INTO t2 (id1, id2) VALUES (1, 1); INSERT INTO t2 (id1, id2) VALUES (1, 2); INSERT INTO t2 (id1, id2) VALUES (2, 1); INSERT INTO t2 (id1, id2) VALUES (2, 2); SELECT t1.id1, t2.id1, t2.id2 FROM t1, t2 ORDER BY t1.id1, t2.id1, t2.id2; } sql execute -execute reader -format list $db $sql } -cleanup { cleanupDb $fileName unset -nocomplain sql db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {1 1 1 1 1 2 1 2 1 1 2 2 2 1 1 2 1 2 2 2 1 2 2 2}} ############################################################################### runTest {test tkt-7e3fa93744-1.2 {composite primary key, DataTable} -setup { setupDb [set fileName tkt-7e3fa93744-1.2.db] } -body { set id [object invoke Interpreter.GetActive NextId] set dataSource [file join [getTemporaryPath] $fileName] set sql(1) { CREATE TABLE t1 ( id1 INTEGER PRIMARY KEY NOT NULL ); CREATE TABLE t2 ( id1 INTEGER NOT NULL, id2 INTEGER NOT NULL, PRIMARY KEY (id1, id2) ); INSERT INTO t1 (id1) VALUES (1); INSERT INTO t1 (id1) VALUES (2); INSERT INTO t2 (id1, id2) VALUES (1, 1); INSERT INTO t2 (id1, id2) VALUES (1, 2); INSERT INTO t2 (id1, id2) VALUES (2, 1); INSERT INTO t2 (id1, id2) VALUES (2, 2); } set sql(2) { \ SELECT t1.id1, t2.id1, t2.id2 \ FROM t1, t2 \ ORDER BY t1.id1, t2.id1, t2.id2; \ } sql execute $db $sql(1) unset -nocomplain results errors set code [compileCSharpWith [subst { using System; using System.Data; using System.Data.SQLite; namespace _Dynamic${id} { public class Test${id} { public static int Main() { using (SQLiteConnection connection = new SQLiteConnection( "Data Source=${dataSource};")) { connection.Open(); using (SQLiteCommand command = connection.CreateCommand()) { command.CommandText = "${sql(2)}"; using (SQLiteDataReader dataReader = command.ExecuteReader()) { DataTable dataTable = new DataTable(); dataTable.Load(dataReader); return dataTable.Rows.Count; } } } } } } }] results errors System.Data.SQLite.dll] list $code $results \ [expr {[info exists errors] ? $errors : ""}] \ [expr {$code eq "Ok" ? [catch { object invoke _Dynamic${id}.Test${id} Main } result] : [set result ""]}] $result } -cleanup { cleanupDb $fileName unset -nocomplain result code results errors sql dataSource id db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -match \ regexp -result {^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 8$}} ############################################################################### runSQLiteTestEpilogue runTestEpilogue |