From: shaneh Date: Thu, 18 Nov 2010 15:44:59 +0000 (+0000) Subject: Added some tests to check that umlaut characters are supported in filenames. X-Git-Tag: version-3.7.4~48 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=13acedf254147d2b0c7bc7e258c61c586e1bfcff;p=thirdparty%2Fsqlite.git Added some tests to check that umlaut characters are supported in filenames. FossilOrigin-Name: c36f275d70ec8f6dead6adac02885026fdff9666 --- diff --git a/manifest b/manifest index 52d72cf809..3cb5c587f0 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,5 @@ ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA1 - -C Restrict\sthe\sscope\sof\sthe\sfts3ExprCost()\ssubroutine\sinside\sof\sFTS3. -D 2010-11-18T13:52:34 +C Added\ssome\stests\sto\scheck\sthat\sumlaut\scharacters\sare\ssupported\sin\sfilenames. +D 2010-11-18T15:44:59 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in e7a59672eaeb04408d1fa8501618d7501a3c5e39 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -299,6 +296,7 @@ F test/capi3.test 1945a2ba75e3f4c49d5beb8fc092115b6292d471 F test/capi3b.test efb2b9cfd127efa84433cd7a2d72ce0454ae0dc4 F test/capi3c.test bea67403a5e37a4b33230ee4723e315a2ffb31e7 F test/capi3d.test cd36571f014f34bdc4421967f6453cbb597d5d16 +F test/capi3e.test f57488502e00902e6a1f560a0620a96dcc0b8efb F test/cast.test 166951664a0b0a2e0f8fb5997a152490c6363932 F test/check.test db2b29d557544347d28e25b8406f5d5ecc3d1bc3 F test/coalesce.test cee0dccb9fbd2d494b77234bccf9dc6c6786eb91 @@ -889,14 +887,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 6c4f1d5c24522d1f541a2b96b229ad0374f99c19 -R ac913fc20e1e02fd0b006b5e555bc903 -U drh -Z b87890169f2f3c0ac5b674e9aa2c08bf ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1.4.6 (GNU/Linux) - -iD8DBQFM5S+loxKgR168RlERAq0hAJ4uVME2ihBNvqhgUgbGV8emWfA7cwCfTZeO -DPJoe01N82TXmbetUlKsCvM= -=x8Xm ------END PGP SIGNATURE----- +P 76681870a4705179f78976e7fda638a6fea0b9f9 +R 919bf4eab147c8998416dfbf378b675b +U shaneh +Z aafd80be2caa03cdbfe5df1baca3e3f0 diff --git a/manifest.uuid b/manifest.uuid index 3daa67bb60..749e222b90 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -76681870a4705179f78976e7fda638a6fea0b9f9 \ No newline at end of file +c36f275d70ec8f6dead6adac02885026fdff9666 \ No newline at end of file diff --git a/test/capi3e.test b/test/capi3e.test new file mode 100644 index 0000000000..c4f9d47c20 --- /dev/null +++ b/test/capi3e.test @@ -0,0 +1,115 @@ +# 2010 Novemeber 18 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# This file implements regression tests for SQLite library. The +# focus of this script testing the callback-free C/C++ API. +# +# $Id: capi3e.test,v 1.70 2009/01/09 02:49:32 drh Exp $ +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +# Do not use a codec for tests in this file, as the database file is +# manipulated directly using tcl scripts (using the [hexio_write] command). +# +do_not_use_codec + +# Return the UTF-16 representation of the supplied UTF-8 string $str. +# If $nt is true, append two 0x00 bytes as a nul terminator. +proc utf16 {str {nt 1}} { + set r [encoding convertto unicode $str] + if {$nt} { + append r "\x00\x00" + } + return $r +} + +# Return the UTF-8 representation of the supplied UTF-16 string $str. +proc utf8 {str} { + # If $str ends in two 0x00 0x00 bytes, knock these off before + # converting to UTF-8 using TCL. + binary scan $str \c* vals + if {[lindex $vals end]==0 && [lindex $vals end-1]==0} { + set str [binary format \c* [lrange $vals 0 end-2]] + } + + set r [encoding convertfrom unicode $str] + return $r +} + +# These tests complement those in capi2.test. They are organized +# as follows: +# +# capi3e-1.*: Test sqlite3_open with various UTF8 filenames +# capi3e-2.*: Test sqlite3_open16 with various UTF8 filenames +# capi3e-3.*: Test ATTACH with various UTF8 filenames + +db close + +# here's the list of file names we're testing +set names {t 1 t. 1. t.d 1.d t-1 1-1 t.db ä.db ë.db ö.db ü.db ÿ.db} + +set i 0 +foreach name $names { + incr i + do_test capi3e-1.1.$i { + set db2 [sqlite3_open $name {}] + sqlite3_errcode $db2 + } {SQLITE_OK} + do_test capi3e-1.2.$i { + sqlite3_close $db2 + } {SQLITE_OK} + do_test capi3e-1.3.$i { + file isfile $name + } {1} +} + +set i 0 +foreach name $names { + incr i + do_test capi3e-2.1.$i { + set db2 [sqlite3_open16 [utf16 $name] {}] + sqlite3_errcode $db2 + } {SQLITE_OK} + do_test capi3e-2.2.$i { + sqlite3_close $db2 + } {SQLITE_OK} + do_test capi3e-2.3.$i { + file isfile $name + } {1} +} + +ifcapable attach { + do_test capi3e-3.1 { + sqlite3 db2 base.db + } {} + set i 0 + foreach name $names { + incr i + do_test capi3e-3.2.$i { + db2 eval "ATTACH DATABASE '$name' AS db$i;" + } {} + do_test capi3e-3.3.$i { + db2 eval "DETACH DATABASE db$i;" + } {} + } + do_test capi3e-3.4 { + db2 close + } {} +} + +# clean up +forcedelete base.db +foreach name $names { + forcedelete $name +} + +finish_test