Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: third_party/sqlite/src/test/vtabH.test

Issue 2751253002: [sql] Import SQLite 3.17.0. (Closed)
Patch Set: also clang on Linux i386 Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/sqlite/src/test/vtabF.test ('k') | third_party/sqlite/src/test/vtab_shared.test » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/src/test/vtabH.test
diff --git a/third_party/sqlite/src/test/vtabH.test b/third_party/sqlite/src/test/vtabH.test
index 7bd542e05b0c7acc2458562981fa078b90bbfc5f..3ce457ff0b219ab14cf1bec76ab4dad4f1e7cb67 100644
--- a/third_party/sqlite/src/test/vtabH.test
+++ b/third_party/sqlite/src/test/vtabH.test
@@ -68,19 +68,19 @@ set x7 backbone
set x8 backarrow
set x9 castle
-db func glob gfunc
+db func glob -argcount 2 gfunc
proc gfunc {a b} {
incr ::gfunc
return 1
}
-db func like lfunc
+db func like -argcount 2 lfunc
proc lfunc {a b} {
incr ::gfunc 100
return 1
}
-db func regexp rfunc
+db func regexp -argcount 2 rfunc
proc rfunc {a b} {
incr ::gfunc 10000
return 1
@@ -108,7 +108,12 @@ foreach ::tclvar_set_omit {0 1} {
#-------------------------------------------------------------------------
#
-if {1} {
+if {$tcl_platform(platform)=="windows"} {
+ set drive [string range [pwd] 0 1]
+ set ::env(fstreeDrive) $drive
+}
+if {$tcl_platform(platform)!="windows" || \
+ [regexp -nocase -- {^[A-Z]:} $drive]} {
reset_db
register_fs_module db
do_execsql_test 3.0 {
@@ -116,31 +121,65 @@ if {1} {
SELECT name FROM fsdir WHERE dir = '.' AND name = '.'
} {test.db .}
+ proc sort_files { names {nocase false} } {
+ if {$nocase && $::tcl_platform(platform) eq "windows"} {
+ return [lsort -nocase $names]
+ } else {
+ return [lsort $names]
+ }
+ }
+
proc list_root_files {} {
if {$::tcl_platform(platform) eq "windows"} {
- set res [list]
- foreach name [glob -directory $::env(SystemDrive)/ -- *] {
+ set res [list]; set dir $::env(fstreeDrive)/; set names [list]
+ eval lappend names [glob -nocomplain -directory $dir -- *]
+ foreach name $names {
if {[string index [file tail $name] 0] eq "."} continue
+ if {[file attributes $name -hidden]} continue
+ if {[file attributes $name -system]} continue
lappend res $name
}
- return $res
+ return [sort_files $res true]
} else {
- return [string map {/ {}} [glob /*]]
+ return [sort_files [string map {/ {}} [glob -nocomplain -- /*]]]
}
}
proc list_files { pattern } {
if {$::tcl_platform(platform) eq "windows"} {
- set res [list]
- foreach name [glob -nocomplain $pattern] {
+ set res [list]; set names [list]
+ eval lappend names [glob -nocomplain -- $pattern]
+ foreach name $names {
if {[string index [file tail $name] 0] eq "."} continue
+ if {[file attributes $name -hidden]} continue
+ if {[file attributes $name -system]} continue
lappend res $name
}
- return $res
+ return [sort_files $res]
+ } else {
+ return [sort_files [glob -nocomplain -- $pattern]]
+ }
+ }
+
+ # Read the first 5 entries from the root directory. Except, ignore
+ # files that contain the "$" character in their names as these are
+ # special files on some Windows platforms.
+ #
+ set res [list]
+ set root_files [list_root_files]
+ foreach p $root_files {
+ if {$::tcl_platform(platform) eq "windows"} {
+ if {![regexp {\$} $p]} {lappend res $p}
} else {
- return [glob -nocomplain $pattern]
+ lappend res "/$p"
}
}
+ set num_root_files [llength $root_files]
+ do_test 3.1 {
+ sort_files [execsql {
+ SELECT path FROM fstree WHERE path NOT GLOB '*\$*' LIMIT $num_root_files;
+ }] true
+ } [sort_files $res true]
# Read all entries in the current directory.
#
@@ -158,7 +197,7 @@ if {1} {
set res [contents $pwd]
do_execsql_test 3.2 {
SELECT path FROM fstree WHERE path GLOB $pwd ORDER BY 1
- } [lsort $res]
+ } [sort_files $res]
# Add some sub-directories and files to the current directory.
#
« no previous file with comments | « third_party/sqlite/src/test/vtabF.test ('k') | third_party/sqlite/src/test/vtab_shared.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698