OLD | NEW |
1 # 2010 Novemeber 18 | 1 # 2010 Novemeber 18 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
11 # This file implements regression tests for SQLite library. The | 11 # This file implements regression tests for SQLite library. The |
12 # focus of this script testing the callback-free C/C++ API. | 12 # focus of this script testing the callback-free C/C++ API. |
13 # | 13 # |
14 # $Id: capi3e.test,v 1.70 2009/01/09 02:49:32 drh Exp $ | 14 # $Id: capi3e.test,v 1.70 2009/01/09 02:49:32 drh Exp $ |
15 # | 15 # |
16 | 16 |
17 set testdir [file dirname $argv0] | 17 set testdir [file dirname $argv0] |
18 source $testdir/tester.tcl | 18 source $testdir/tester.tcl |
19 | 19 |
20 # Make sure the system encoding is utf-8. Otherwise, if the system encoding | 20 # Make sure the system encoding is utf-8. Otherwise, if the system encoding |
21 # is other than utf-8, [file isfile $x] may not refer to the same file | 21 # is other than utf-8, [file isfile $x] may not refer to the same file |
22 # as [sqlite3 db $x]. | 22 # as [sqlite3 db $x]. |
23 encoding system utf-8 | 23 # |
| 24 # This is no longer needed here because it should be done within the test |
| 25 # fixture executable itself, via Tcl_SetSystemEncoding. |
| 26 # |
| 27 # encoding system utf-8 |
24 | 28 |
25 # Do not use a codec for tests in this file, as the database file is | 29 # Do not use a codec for tests in this file, as the database file is |
26 # manipulated directly using tcl scripts (using the [hexio_write] command). | 30 # manipulated directly using tcl scripts (using the [hexio_write] command). |
27 # | 31 # |
28 do_not_use_codec | 32 do_not_use_codec |
29 | 33 |
30 # Return the UTF-16 representation of the supplied UTF-8 string $str. | 34 # Return the UTF-16 representation of the supplied UTF-8 string $str. |
31 # If $nt is true, append two 0x00 bytes as a nul terminator. | 35 # If $nt is true, append two 0x00 bytes as a nul terminator. |
32 proc utf16 {str {nt 1}} { | 36 proc utf16 {str {nt 1}} { |
33 set r [encoding convertto unicode $str] | 37 set r [encoding convertto unicode $str] |
(...skipping 19 matching lines...) Expand all Loading... |
53 # These tests complement those in capi2.test. They are organized | 57 # These tests complement those in capi2.test. They are organized |
54 # as follows: | 58 # as follows: |
55 # | 59 # |
56 # capi3e-1.*: Test sqlite3_open with various UTF8 filenames | 60 # capi3e-1.*: Test sqlite3_open with various UTF8 filenames |
57 # capi3e-2.*: Test sqlite3_open16 with various UTF8 filenames | 61 # capi3e-2.*: Test sqlite3_open16 with various UTF8 filenames |
58 # capi3e-3.*: Test ATTACH with various UTF8 filenames | 62 # capi3e-3.*: Test ATTACH with various UTF8 filenames |
59 | 63 |
60 db close | 64 db close |
61 | 65 |
62 # here's the list of file names we're testing | 66 # here's the list of file names we're testing |
63 set names {t 1 t. 1. t.d 1.d t-1 1-1 t.db ä.db ë.db ö.db ü.db ÿ.db} | 67 set names {t 1 t. 1. t.d 1.d t-1 1-1 t.db ä.db ë.db ö.db ü.db ÿ.db} |
64 | 68 |
65 set i 0 | 69 set i 0 |
66 foreach name $names { | 70 foreach name $names { |
67 incr i | 71 incr i |
68 do_test capi3e-1.1.$i { | 72 do_test capi3e-1.1.$i { |
69 set db2 [sqlite3_open $name {}] | 73 set db2 [sqlite3_open $name {}] |
70 sqlite3_errcode $db2 | 74 sqlite3_errcode $db2 |
71 } {SQLITE_OK} | 75 } {SQLITE_OK} |
72 do_test capi3e-1.2.$i { | 76 do_test capi3e-1.2.$i { |
73 sqlite3_close $db2 | 77 sqlite3_close $db2 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 } {} | 117 } {} |
114 } | 118 } |
115 | 119 |
116 # clean up | 120 # clean up |
117 forcedelete base.db | 121 forcedelete base.db |
118 foreach name $names { | 122 foreach name $names { |
119 forcedelete $name | 123 forcedelete $name |
120 } | 124 } |
121 | 125 |
122 finish_test | 126 finish_test |
OLD | NEW |