Fossil SCM

fossil-scm / test / glob.test
Source Blame History 190 lines
a93b58c… drh 1 #
a93b58c… drh 2 # Copyright (c) 2013 D. Richard Hipp
a93b58c… drh 3 #
a93b58c… drh 4 # This program is free software; you can redistribute it and/or
a93b58c… drh 5 # modify it under the terms of the Simplified BSD License (also
a93b58c… drh 6 # known as the "2-Clause License" or "FreeBSD License".)
a93b58c… drh 7 #
a93b58c… drh 8 # This program is distributed in the hope that it will be useful,
a93b58c… drh 9 # but without any warranty; without even the implied warranty of
a93b58c… drh 10 # merchantability or fitness for a particular purpose.
a93b58c… drh 11 #
a93b58c… drh 12 # Author contact information:
a93b58c… drh 13 # [email protected]
a93b58c… drh 14 # http://www.hwaci.com/drh/
a93b58c… drh 15 #
a93b58c… drh 16 ############################################################################
a93b58c… drh 17 #
a93b58c… drh 18 # Test glob pattern parsing
a93b58c… drh 19 #
a93b58c… drh 20
fa59221… mistachkin 21 test_setup ""
fa59221… mistachkin 22
a93b58c… drh 23 proc glob-parse {testname args} {
a93b58c… drh 24 set i 1
a93b58c… drh 25 foreach {pattern string result} $args {
a93b58c… drh 26 fossil test-glob $pattern $string
a93b58c… drh 27 test glob-parse-$testname.$i {$::RESULT eq $result}
a93b58c… drh 28 incr i
a93b58c… drh 29 }
a93b58c… drh 30 }
a93b58c… drh 31
a93b58c… drh 32 glob-parse 100 test test [string map [list \r\n \n] \
a93b58c… drh 33 {SQL expression: (x GLOB 'test')
a93b58c… drh 34 pattern[0] = [test]
d663a32… florian 35 1 1 test}]
a93b58c… drh 36
a93b58c… drh 37 glob-parse 101 "one two" one [string map [list \r\n \n] \
a93b58c… drh 38 {SQL expression: (x GLOB 'one' OR x GLOB 'two')
a93b58c… drh 39 pattern[0] = [one]
a93b58c… drh 40 pattern[1] = [two]
d663a32… florian 41 1 1 one}]
a93b58c… drh 42
a93b58c… drh 43 glob-parse 102 t* test [string map [list \r\n \n] \
a93b58c… drh 44 {SQL expression: (x GLOB 't*')
a93b58c… drh 45 pattern[0] = [t*]
d663a32… florian 46 1 1 test}]
a93b58c… drh 47
a93b58c… drh 48 glob-parse 103 "o* two" one [string map [list \r\n \n] \
a93b58c… drh 49 {SQL expression: (x GLOB 'o*' OR x GLOB 'two')
a93b58c… drh 50 pattern[0] = [o*]
a93b58c… drh 51 pattern[1] = [two]
d663a32… florian 52 1 1 one}]
a93b58c… drh 53
a93b58c… drh 54 glob-parse 104 {"o* two" "three four"} "one two" [string map [list \r\n \n] \
a93b58c… drh 55 {SQL expression: (x GLOB 'o* two' OR x GLOB 'three four')
a93b58c… drh 56 pattern[0] = [o* two]
a93b58c… drh 57 pattern[1] = [three four]
d663a32… florian 58 1 1 one two}]
a93b58c… drh 59
a93b58c… drh 60 glob-parse 105 {"o* two" "three four"} "two one" [string map [list \r\n \n] \
a93b58c… drh 61 {SQL expression: (x GLOB 'o* two' OR x GLOB 'three four')
a93b58c… drh 62 pattern[0] = [o* two]
a93b58c… drh 63 pattern[1] = [three four]
d663a32… florian 64 0 0 two one}]
a93b58c… drh 65
a93b58c… drh 66 glob-parse 106 "\"o*\ntwo\" \"three\nfour\"" "one\ntwo" \
a93b58c… drh 67 [string map [list \r\n \n] \
a93b58c… drh 68 {SQL expression: (x GLOB 'o*
a93b58c… drh 69 two' OR x GLOB 'three
a93b58c… drh 70 four')
a93b58c… drh 71 pattern[0] = [o*
a93b58c… drh 72 two]
a93b58c… drh 73 pattern[1] = [three
a93b58c… drh 74 four]
d663a32… florian 75 1 1 one
a93b58c… drh 76 two}]
a93b58c… drh 77
a93b58c… drh 78 glob-parse 107 "\"o*\ntwo\" \"three\nfour\"" "two\none" \
a93b58c… drh 79 [string map [list \r\n \n] \
a93b58c… drh 80 {SQL expression: (x GLOB 'o*
a93b58c… drh 81 two' OR x GLOB 'three
a93b58c… drh 82 four')
a93b58c… drh 83 pattern[0] = [o*
a93b58c… drh 84 two]
a93b58c… drh 85 pattern[1] = [three
a93b58c… drh 86 four]
d663a32… florian 87 0 0 two
a93b58c… drh 88 one}]
a93b58c… drh 89
a93b58c… drh 90 glob-parse 108 "\"o*\rtwo\" \"three\rfour\"" "one\rtwo" \
a93b58c… drh 91 [string map [list \r\n \n] \
a93b58c… drh 92 {SQL expression: (x GLOB 'o*
a93b58c… drh 93 two' OR x GLOB 'three
a93b58c… drh 94 four')
a93b58c… drh 95 pattern[0] = [o*
a93b58c… drh 96 two]
a93b58c… drh 97 pattern[1] = [three
a93b58c… drh 98 four]
d663a32… florian 99 1 1 one
a93b58c… drh 100 two}]
a93b58c… drh 101
a93b58c… drh 102 glob-parse 109 "\"o*\rtwo\" \"three\rfour\"" "two\rone" \
a93b58c… drh 103 [string map [list \r\n \n] \
a93b58c… drh 104 {SQL expression: (x GLOB 'o*
a93b58c… drh 105 two' OR x GLOB 'three
a93b58c… drh 106 four')
a93b58c… drh 107 pattern[0] = [o*
a93b58c… drh 108 two]
a93b58c… drh 109 pattern[1] = [three
a93b58c… drh 110 four]
d663a32… florian 111 0 0 two
a93b58c… drh 112 one}]
a93b58c… drh 113
a93b58c… drh 114 glob-parse 110 "'o*\ntwo' 'three\nfour'" "one\ntwo" \
a93b58c… drh 115 [string map [list \r\n \n] \
a93b58c… drh 116 {SQL expression: (x GLOB 'o*
a93b58c… drh 117 two' OR x GLOB 'three
a93b58c… drh 118 four')
a93b58c… drh 119 pattern[0] = [o*
a93b58c… drh 120 two]
a93b58c… drh 121 pattern[1] = [three
a93b58c… drh 122 four]
d663a32… florian 123 1 1 one
a93b58c… drh 124 two}]
a93b58c… drh 125
a93b58c… drh 126 glob-parse 111 "'o*\ntwo' 'three\nfour'" "two\none" \
a93b58c… drh 127 [string map [list \r\n \n] \
a93b58c… drh 128 {SQL expression: (x GLOB 'o*
a93b58c… drh 129 two' OR x GLOB 'three
a93b58c… drh 130 four')
a93b58c… drh 131 pattern[0] = [o*
a93b58c… drh 132 two]
a93b58c… drh 133 pattern[1] = [three
a93b58c… drh 134 four]
d663a32… florian 135 0 0 two
a93b58c… drh 136 one}]
a93b58c… drh 137
a93b58c… drh 138 glob-parse 112 "\"'o*' 'two'\" \"'three' 'four'\"" "'one' 'two'" \
a93b58c… drh 139 [string map [list \r\n \n] \
a93b58c… drh 140 {SQL expression: (x GLOB '''o*'' ''two''' OR x GLOB '''three'' ''four''')
a93b58c… drh 141 pattern[0] = ['o*' 'two']
a93b58c… drh 142 pattern[1] = ['three' 'four']
d663a32… florian 143 1 1 'one' 'two'}]
a93b58c… drh 144
a93b58c… drh 145 glob-parse 113 "\"'o*' 'two'\" \"'three' 'four'\"" "two one" \
a93b58c… drh 146 [string map [list \r\n \n] \
a93b58c… drh 147 {SQL expression: (x GLOB '''o*'' ''two''' OR x GLOB '''three'' ''four''')
a93b58c… drh 148 pattern[0] = ['o*' 'two']
a93b58c… drh 149 pattern[1] = ['three' 'four']
d663a32… florian 150 0 0 two one}]
a93b58c… drh 151
a93b58c… drh 152 glob-parse 114 o*,two one [string map [list \r\n \n] \
a93b58c… drh 153 {SQL expression: (x GLOB 'o*' OR x GLOB 'two')
a93b58c… drh 154 pattern[0] = [o*]
a93b58c… drh 155 pattern[1] = [two]
d663a32… florian 156 1 1 one}]
a93b58c… drh 157
a93b58c… drh 158 glob-parse 115 "o*,two three,four" "one two" [string map [list \r\n \n] \
a93b58c… drh 159 {SQL expression: (x GLOB 'o*' OR x GLOB 'two' OR x GLOB 'three' OR x GLOB 'four')
a93b58c… drh 160 pattern[0] = [o*]
a93b58c… drh 161 pattern[1] = [two]
a93b58c… drh 162 pattern[2] = [three]
a93b58c… drh 163 pattern[3] = [four]
d663a32… florian 164 1 1 one two}]
a93b58c… drh 165
a93b58c… drh 166 glob-parse 116 'o*,two' one [string map [list \r\n \n] \
a93b58c… drh 167 {SQL expression: (x GLOB 'o*,two')
a93b58c… drh 168 pattern[0] = [o*,two]
d663a32… florian 169 0 0 one}]
a93b58c… drh 170
a93b58c… drh 171 glob-parse 117 'o*,two' one,two [string map [list \r\n \n] \
a93b58c… drh 172 {SQL expression: (x GLOB 'o*,two')
a93b58c… drh 173 pattern[0] = [o*,two]
d663a32… florian 174 1 1 one,two}]
a93b58c… drh 175
a93b58c… drh 176 glob-parse 118 "'o*,two three,four'" "one two three,four" \
a93b58c… drh 177 [string map [list \r\n \n] \
a93b58c… drh 178 {SQL expression: (x GLOB 'o*,two three,four')
a93b58c… drh 179 pattern[0] = [o*,two three,four]
d663a32… florian 180 0 0 one two three,four}]
a93b58c… drh 181
a93b58c… drh 182 glob-parse 119 "'o*,two three,four'" "one,two three,four" \
a93b58c… drh 183 [string map [list \r\n \n] \
a93b58c… drh 184 {SQL expression: (x GLOB 'o*,two three,four')
a93b58c… drh 185 pattern[0] = [o*,two three,four]
d663a32… florian 186 1 1 one,two three,four}]
fa59221… mistachkin 187
fa59221… mistachkin 188 ###############################################################################
fa59221… mistachkin 189
fa59221… mistachkin 190 test_cleanup

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button