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
|
# -*- tcl -*-
# docidx_parse.test: tests for the doctools::idx::parse package.
#
# Copyright (c) 2009 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
# All rights reserved.
#
# RCS: @(#) $Id: parse.test,v 1.1 2009/04/01 04:28:37 andreas_kupries Exp $
# -------------------------------------------------------------------------
source [file join \
[file dirname [file dirname [file join [pwd] [info script]]]] \
devtools testutilities.tcl]
testsNeedTcl 8.4
testsNeedTcltest 2.0
support {
useAccel [useTcllibC] struct/tree.tcl struct::tree
TestAccelInit struct::tree
useAccel [useTcllibC] struct/stack.tcl struct::stack
TestAccelInit struct::stack
useAccel [useTcllibC] struct/sets.tcl struct::set
TestAccelInit struct::set
use struct/list.tcl struct::list
use snit/snit.tcl snit
use fileutil/fileutil.tcl fileutil
use log/logger.tcl logger
use treeql/treeql.tcl treeql
use doctools2base/tcl_parse.tcl doctools::tcl::parse
use doctools2base/msgcat.tcl doctools::msgcat
useLocal msgcat_c.tcl doctools::msgcat::idx::c
useLocal structure.tcl doctools::idx::structure
msgcat::mclocale C
}
testing {
useLocal parse.tcl doctools::idx::parse
}
# -------------------------------------------------------------------------
# General set of error cases regarding the number of arguments.
test doctools-idx-parse-1.0 {parse file, wrong#args} -body {
doctools::idx::parse file
} -returnCodes error -result {wrong # args: should be "::doctools::idx::parse::Snit_typemethodfile type path"}
test doctools-idx-parse-1.1 {parse file, wrong#args} -body {
doctools::idx::parse file P XXX
} -returnCodes error -result {wrong # args: should be "::doctools::idx::parse::Snit_typemethodfile type path"}
test doctools-idx-parse-2.0 {parse text, wrong#args} -body {
doctools::idx::parse text
} -returnCodes error -result {wrong # args: should be "::doctools::idx::parse::Snit_typemethodtext type text ?path?"}
test doctools-idx-parse-2.1 {parse text, wrong#args} -body {
doctools::idx::parse text T P XXX
} -returnCodes error -result {wrong # args: should be "::doctools::idx::parse::Snit_typemethodtext type text ?path?"}
test doctools-idx-parse-3.0 {vars, wrong#args} -body {
doctools::idx::parse vars XXX
} -returnCodes error -result {wrong # args: should be "::doctools::idx::parse::Snit_typemethodvars type"}
test doctools-idx-parse-4.0 {var, bogus submethod} -body {
doctools::idx::parse var bogus
} -returnCodes error -result {"::doctools::idx::parse var bogus" is not defined}
test doctools-idx-parse-5.0 {var set, wrong#args} -body {
doctools::idx::parse var set
} -returnCodes error -result {wrong # args: should be "::doctools::idx::parse::Snit_htypemethodvar_set type name value"}
test doctools-idx-parse-5.1 {var set, wrong#args} -body {
doctools::idx::parse var set N
} -returnCodes error -result {wrong # args: should be "::doctools::idx::parse::Snit_htypemethodvar_set type name value"}
test doctools-idx-parse-5.2 {var set, wrong#args} -body {
doctools::idx::parse var set N V XXX
} -returnCodes error -result {wrong # args: should be "::doctools::idx::parse::Snit_htypemethodvar_set type name value"}
test doctools-idx-parse-6.0 {var load, wrong#args} -body {
doctools::idx::parse var load
} -returnCodes error -result {wrong # args: should be "::doctools::idx::parse::Snit_htypemethodvar_load type dict"}
test doctools-idx-parse-6.1 {var load, wrong#args} -body {
doctools::idx::parse var load D XXX
} -returnCodes error -result {wrong # args: should be "::doctools::idx::parse::Snit_htypemethodvar_load type dict"}
# var unset - 0+ arguments, no checking possible.
test doctools-idx-parse-7.0 {includes, wrong#args} -body {
doctools::idx::parse includes XXX
} -returnCodes error -result {wrong # args: should be "::doctools::idx::parse::Snit_typemethodincludes type"}
test doctools-idx-parse-8.0 {include, bogus submethod} -body {
doctools::idx::parse include bogus
} -returnCodes error -result {"::doctools::idx::parse include bogus" is not defined}
test doctools-idx-parse-9.0 {include set, wrong#args} -body {
doctools::idx::parse include set
} -returnCodes error -result {wrong # args: should be "::doctools::idx::parse::Snit_htypemethodinclude_set type paths"}
test doctools-idx-parse-9.1 {include set, wrong#args} -body {
doctools::idx::parse include set P XXX
} -returnCodes error -result {wrong # args: should be "::doctools::idx::parse::Snit_htypemethodinclude_set type paths"}
test doctools-idx-parse-10.0 {include add, wrong#args} -body {
doctools::idx::parse include add
} -returnCodes error -result {wrong # args: should be "::doctools::idx::parse::Snit_htypemethodinclude_add type path"}
test doctools-idx-parse-10.1 {include add, wrong#args} -body {
doctools::idx::parse include add P XXX
} -returnCodes error -result {wrong # args: should be "::doctools::idx::parse::Snit_htypemethodinclude_add type path"}
test doctools-idx-parse-11.0 {include remove, wrong#args} -body {
doctools::idx::parse include remove
} -returnCodes error -result {wrong # args: should be "::doctools::idx::parse::Snit_htypemethodinclude_remove type path"}
test doctools-idx-parse-11.1 {include remove, wrong#args} -body {
doctools::idx::parse include remove P XXX
} -returnCodes error -result {wrong # args: should be "::doctools::idx::parse::Snit_htypemethodinclude_remove type path"}
test doctools-idx-parse-12.0 {include clear, wrong#args} -body {
doctools::idx::parse include clear XXX
} -returnCodes error -result {wrong # args: should be "::doctools::idx::parse::Snit_htypemethodinclude_clear type"}
# idx_parse tests, numbering starts at 20
# -------------------------------------------------------------------------
array_unset env LANG*
array_unset env LC_*
set env(LANG) C ; # Usually default if nothing is set, OS X requires this.
# -------------------------------------------------------------------------
TestAccelDo struct::stack stkimpl {
TestAccelDo struct::set setimpl {
TestAccelDo struct::tree impl {
source [localPath tests/parse]
}
}
}
#----------------------------------------------------------------------
TestAccelExit struct::tree
TestAccelExit struct::set
TestAccelExit struct::stack
testsuiteCleanup
return
|