Enhance the command-line completion extension to return the names of
[sqlite.git] / test / uri2.test
blob52feb7b50ffcbf9b44a831a6161c66333bddf979
1 # 2016 October 26
3 # The author disclaims copyright to this source code.  In place of
4 # a legal notice, here is a blessing:
6 #    May you do good and not evil.
7 #    May you find forgiveness for yourself and forgive others.
8 #    May you share freely, never taking more than you give.
10 #***********************************************************************
12 # Tests for SQLITE_ENABLE_URI_00_ERROR builds.
14 set testdir [file dirname $argv0]
15 source $testdir/tester.tcl
17 ifcapable !uri_00_error {
18   finish_test
19   return
22 set testprefix uri2
23 db close
24 sqlite3_shutdown
25 sqlite3_config_uri 1
27 foreach {tn uri} {
28   1 file:test.db%00trailing
29   2 file:test.db?%00trailing=1
30   3 file:test.db?trailing=1%00
31   4 file:test.db?trailing=1&abc%00def
32   5 file:test.db?trailing=1&abc%00def
33 } {
34   do_test 1.$tn.1 {
35     set rc [catch { sqlite3 db $uri } msg]
36     list $rc $msg
37   } {1 {unexpected %00 in uri}}
39   do_test 1.$tn.2 {
40     set DB2 [sqlite3_open $uri]
41     sqlite3_errcode $DB2
42   } {SQLITE_ERROR}
44   catch { sqlite3_close $DB2 }
46   do_test 1.$tn.2 {
47     sqlite3 db ""
48     catchsql { ATTACH $uri AS aux }
49   } {1 {unexpected %00 in uri}}
51   do_test 1.$tn.3 {
52     sqlite3_errcode db
53   } {SQLITE_ERROR}
55   catch { db close }
58 reset_db
59 do_test 2.0 {
60   expr {[lsearch [execsql {PRAGMA compile_options}] ENABLE_URI_00_ERROR] >= 0}
61 } 1
63 finish_test