1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377
|
# -*- tcl -*-
# -- idx_import.test:
# -- Tests for package "doctools::idx::import": Management of import plugins.
#
# Copyright (c) 2009-2019 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
# All rights reserved.
# -------------------------------------------------------------------------
source [file join \
[file dirname [file dirname [file join [pwd] [info script]]]] \
devtools testutilities.tcl]
testsNeedTcl 8.4
testsNeedTcltest 2
support {
use struct/list.tcl struct::list
use snit/snit.tcl snit
use fileutil/fileutil.tcl fileutil
use fileutil/paths.tcl fileutil::paths
use log/logger.tcl logger
use pluginmgr/pluginmgr.tcl pluginmgr
use struct/map.tcl struct::map
source [tcllibPath doctools2base/tests/common]
}
testing {
useLocalKeep import.tcl doctools::idx::import
}
# -------------------------------------------------------------------------
setup_plugins
# -------------------------------------------------------------------------
test doctools-idx-import-1.0 {import text, wrong#args} -setup {
doctools::idx::import I
} -body {
I import text
} -cleanup {
I destroy
} -returnCodes error -result {wrong # args: should be "::doctools::idx::import::Snit_hmethodimport_text type selfns win self text ?format?"}
test doctools-idx-import-1.1 {import text, wrong#args} -setup {
doctools::idx::import I
} -body {
I import text T F XX
} -cleanup {
I destroy
} -returnCodes error -result {wrong # args: should be "::doctools::idx::import::Snit_hmethodimport_text type selfns win self text ?format?"}
test doctools-idx-import-2.0 {import file, wrong#args} -setup {
doctools::idx::import I
} -body {
I import file
} -cleanup {
I destroy
} -returnCodes error -result {wrong # args: should be "::doctools::idx::import::Snit_hmethodimport_file type selfns win self path ?format?"}
test doctools-idx-import-2.1 {import file, wrong#args} -setup {
doctools::idx::import I
} -body {
I import file P F XXX
} -cleanup {
I destroy
} -returnCodes error -result {wrong # args: should be "::doctools::idx::import::Snit_hmethodimport_file type selfns win self path ?format?"}
test doctools-idx-import-3.0 {import object text, wrong#args} -setup {
doctools::idx::import I
} -body {
I import object text
} -cleanup {
I destroy
} -returnCodes error -result {wrong # args: should be "::doctools::idx::import::Snit_hmethodimport_object_text type selfns win self obj text ?format?"}
test doctools-idx-import-3.1 {import object text, wrong#args} -setup {
doctools::idx::import I
} -body {
I import object text O
} -cleanup {
I destroy
} -returnCodes error -result {wrong # args: should be "::doctools::idx::import::Snit_hmethodimport_object_text type selfns win self obj text ?format?"}
test doctools-idx-import-3.2 {import object text, wrong#args} -setup {
doctools::idx::import I
} -body {
I import object text O T F XXX
} -cleanup {
I destroy
} -returnCodes error -result {wrong # args: should be "::doctools::idx::import::Snit_hmethodimport_object_text type selfns win self obj text ?format?"}
test doctools-idx-import-4.0 {import object file, wrong#args} -setup {
doctools::idx::import I
} -body {
I import object file
} -cleanup {
I destroy
} -returnCodes error -result {wrong # args: should be "::doctools::idx::import::Snit_hmethodimport_object_file type selfns win self obj path ?format?"}
test doctools-idx-import-4.1 {import object file, wrong#args} -setup {
doctools::idx::import I
} -body {
I import object file O
} -cleanup {
I destroy
} -returnCodes error -result {wrong # args: should be "::doctools::idx::import::Snit_hmethodimport_object_file type selfns win self obj path ?format?"}
test doctools-idx-import-4.2 {import object file, wrong#args} -setup {
doctools::idx::import I
} -body {
I import object file O P F XXX
} -cleanup {
I destroy
} -returnCodes error -result {wrong # args: should be "::doctools::idx::import::Snit_hmethodimport_object_file type selfns win self obj path ?format?"}
test doctools-idx-import-5.0 {config names, wrong#args} -setup {
doctools::idx::import I
} -body {
I config names X
} -cleanup {
I destroy
} -returnCodes error -result {wrong # args: should be "::struct::map::I::Snit_methodnames type selfns win self"}
test doctools-idx-import-6.0 {config get, wrong#args} -setup {
doctools::idx::import I
} -body {
I config get X
} -cleanup {
I destroy
} -returnCodes error -result {wrong # args: should be "::struct::map::I::Snit_methodget type selfns win self"}
test doctools-idx-import-7.0 {config set, wrong#args} -setup {
doctools::idx::import I
} -body {
I config set
} -cleanup {
I destroy
} -returnCodes error -result {wrong # args: should be "::struct::map::I::Snit_methodset type selfns win self name ?value?"}
test doctools-idx-import-7.1 {config set, wrong#args} -setup {
doctools::idx::import I
} -body {
I config set N V X
} -cleanup {
I destroy
} -returnCodes error -result {wrong # args: should be "::struct::map::I::Snit_methodset type selfns win self name ?value?"}
# config unset - accepts any number of arguments.
# -------------------------------------------------------------------------
## `include paths` component, provided via fileutil::paths, search path for includes
test doctools-idx-import-8.0 {include paths, wrong#args} -setup {
doctools::idx::import I
} -body {
I include paths X
} -cleanup {
I destroy
} -returnCodes error -result {wrong # args: should be "::fileutil::paths::Snit_methodpaths type selfns win self"}
test doctools-idx-import-9.0 {include clear, wrong#args} -setup {
doctools::idx::import I
} -body {
I include clear X
} -cleanup {
I destroy
} -returnCodes error -result {wrong # args: should be "::fileutil::paths::Snit_methodclear type selfns win self"}
test doctools-idx-import-10.0 {include add, wrong#args} -setup {
doctools::idx::import I
} -body {
I include add
} -cleanup {
I destroy
} -returnCodes error -result {wrong # args: should be "::fileutil::paths::Snit_methodadd type selfns win self path"}
test doctools-idx-import-10.1 {include add, wrong#args} -setup {
doctools::idx::import I
} -body {
I include add P X
} -cleanup {
I destroy
} -returnCodes error -result {wrong # args: should be "::fileutil::paths::Snit_methodadd type selfns win self path"}
test doctools-idx-import-11.0 {include remove, wrong#args} -setup {
doctools::idx::import I
} -body {
I include remove
} -cleanup {
I destroy
} -returnCodes error -result {wrong # args: should be "::fileutil::paths::Snit_methodremove type selfns win self path"}
test doctools-idx-import-11.1 {include remove, wrong#args} -setup {
doctools::idx::import I
} -body {
I include remove P X
} -cleanup {
I destroy
} -returnCodes error -result {wrong # args: should be "::fileutil::paths::Snit_methodremove type selfns win self path"}
# -------------------------------------------------------------------------
test doctools-idx-import-12.0 {config set, define single var} -setup {
doctools::idx::import I
} -body {
I config set N V
I config get
} -cleanup {
I destroy
} -result {N V}
test doctools-idx-import-12.1 {config set, define multiple vars} -setup {
doctools::idx::import I
} -body {
I config set N V
I config set A B
dictsort [I config get]
} -cleanup {
I destroy
} -result {A B N V}
test doctools-idx-import-12.2 {config set, as query} -setup {
doctools::idx::import I
I config set N V
} -body {
I config set N
} -cleanup {
I destroy
} -result V
test doctools-idx-import-13.0 {config unset, all} -setup {
doctools::idx::import I
I config set N V
} -body {
I config unset
I config get
} -cleanup {
I destroy
} -result {}
test doctools-idx-import-13.1 {config unset, by exact name} -setup {
doctools::idx::import I
I config set N V
I config set A B
} -body {
I config unset N
I config get
} -cleanup {
I destroy
} -result {A B}
test doctools-idx-import-13.2 {config unset, by glob pattern} -setup {
doctools::idx::import I
I config set N V
I config set N' V'
I config set A B
} -body {
I config unset N*
I config get
} -cleanup {
I destroy
} -result {A B}
test doctools-idx-import-14.0 {config names, empty} -setup {
doctools::idx::import I
} -body {
I config names
} -cleanup {
I destroy
} -result {}
test doctools-idx-import-14.1 {config names, with variables} -setup {
doctools::idx::import I
I config set N V
I config set A B
} -body {
lsort -dict [I config names]
} -cleanup {
I destroy
} -result {A N}
test doctools-idx-import-15.0 {config get, empty} -setup {
doctools::idx::import I
} -body {
I config get
} -cleanup {
I destroy
} -result {}
test doctools-idx-import-15.1 {config get, with variables} -setup {
doctools::idx::import I
I config set N V
I config set A B
} -body {
dictsort [I config get]
} -cleanup {
I destroy
} -result {A B N V}
test doctools-idx-import-16.0 {include paths, empty} -setup {
doctools::idx::import I
} -body {
I include paths
} -cleanup {
I destroy
} -result {}
test doctools-idx-import-16.1 {include paths, several paths, order} -setup {
doctools::idx::import I
I include add first
I include add second
} -body {
I include paths
} -cleanup {
I destroy
} -result {first second}
test doctools-idx-import-17.0 {include add, unknown} -setup {
doctools::idx::import I
} -body {
I include add A
I include paths
} -cleanup {
I destroy
} -result A
test doctools-idx-import-17.1 {include add, already known} -setup {
doctools::idx::import I
} -body {
I include add A
I include add A
I include paths
} -cleanup {
I destroy
} -result A
test doctools-idx-import-18.0 {include remove, unknown} -setup {
doctools::idx::import I
} -body {
I include add A
I include remove B
I include paths
} -cleanup {
I destroy
} -result A
test doctools-idx-import-18.1 {include remove, known} -setup {
doctools::idx::import I
} -body {
I include add A
I include remove A
I include paths
} -cleanup {
I destroy
} -result {}
test doctools-idx-import-19.0 {include clear} -setup {
doctools::idx::import I
} -body {
I include add A
I include add B
I include clear
I include paths
} -cleanup {
I destroy
} -result {}
# idx_import tests, numbering starts at 20
# -------------------------------------------------------------------------
source [localPath tests/import]
#----------------------------------------------------------------------
testsuiteCleanup
return
|