cmdr
Check-in [52969c8c6f]
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Started on testsuite for validation types. Template for the common API signatures.
Timelines: family | ancestors | descendants | both | vtype-testing
Files: files | file ages | folders
SHA1: 52969c8c6f9c505fda554d8776e9d2b260e63dcb
User & Date: andreask 2015-05-09 00:08:29
Context
2015-05-11
22:21
Testing validation types, continued. check-in: 58cb0c6af7 user: aku tags: vtype-testing
2015-05-09
00:08
Started on testsuite for validation types. Template for the common API signatures. check-in: 52969c8c6f user: andreask tags: vtype-testing
00:06
Comment fixes check-in: ebdf8cc004 user: andreask tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Added tests/v_boolean.test.

            1  +# -*- tcl -*- tcl.tk//DSL tcltest//EN//2.0
            2  +# # ## ### ##### ######## ############# #####################
            3  +## Testing the cmdr::validate package (sub: boolean).
            4  +
            5  +kt check Tcl     8.5
            6  +kt check tcltest 2
            7  +
            8  +kt require support debug
            9  +kt require support debug::caller
           10  +
           11  +kt local   support cmdr::validate::common
           12  +kt local   testing cmdr::validate
           13  +
           14  +# # ## ### ##### ######## ############# #####################
           15  +## Basic API.
           16  +
           17  +set vtype cmdr::validate::boolean
           18  +kt source vtype.tcl
           19  +
           20  +# # ## ### ##### ######## ############# #####################
           21  +## Specific behaviour
           22  +
           23  +# # ## ### ##### ######## ############# #####################
           24  +cleanupTests
           25  +return

Added tests/vtype.tcl.

            1  +# -*- tcl -*- tcl.tk//DSL tcltest--template//EN//2.0
            2  +# # ## ### ##### ######## ############# #####################
            3  +## Testing a validation type.
            4  +
            5  +# Sourced from the actual .test file and parameterized with the main
            6  +# ensemble command of the validation type. This file only tests the
            7  +# standard part of the API for the type, i.e. the command
            8  +# signatures. The actual validation, completion, etc. must be tested
            9  +# by the caller, as that changes from type to type.
           10  +#
           11  +# File API variables
           12  +#
           13  +# - "vtype"  - command for the validation type.
           14  +# - "vtparm" - name of the parameter variable used by all VT API commands.
           15  +# - "vtval"  - name of the value variable used by the all VT API commands except "default".
           16  +#
           17  +# The last two can be left unspecified, and will default to "p" and "x", respectively.
           18  +
           19  +if {![info exists vtparm]} { set vtparm p }
           20  +if {![info exists vtval]}  { set vtval  x }
           21  +
           22  +if {![info exists vtype]} {
           23  +    # TODO: kt ... - Abort testsuite
           24  +}
           25  +
           26  +# # ## ### ##### ######## ############# #####################
           27  +## default
           28  +
           29  +test vt-${vtype}-default-1.0 "$vtype default, wrong args, not enough" -body {
           30  +    $vtype default
           31  +} -returnCodes error -result "wrong # args: should be \"$vtype default $vtparm\""
           32  +
           33  +test vt-${vtype}-default-1.1 "$vtype default, wrong args, too many" -body {
           34  +    $vtype default P X
           35  +} -returnCodes error -result "wrong # args: should be \"$vtype default $vtparm\""
           36  +
           37  +# # ## ### ##### ######## ############# #####################
           38  +## validate
           39  +
           40  +test vt-${vtype}-validate-1.0 "$vtype validate, wrong args, not enough" -body {
           41  +    $vtype validate
           42  +} -returnCodes error -result "wrong # args: should be \"$vtype validate $vtparm $vtval\""
           43  +
           44  +test vt-${vtype}-validate-1.1 "$vtype validate, wrong args, not enough" -body {
           45  +    $vtype validate P
           46  +} -returnCodes error -result "wrong # args: should be \"$vtype validate $vtparm $vtval\""
           47  +
           48  +test vt-${vtype}-validate-1.2 "$vtype validate, wrong args, too many" -body {
           49  +    $vtype validate P V X
           50  +} -returnCodes error -result "wrong # args: should be \"$vtype validate $vtparm $vtval\""
           51  +
           52  +# # ## ### ##### ######## ############# #####################
           53  +## complete
           54  +
           55  +test vt-${vtype}-complete-1.0 "$vtype complete, wrong args, not enough" -body {
           56  +    $vtype complete
           57  +} -returnCodes error -result "wrong # args: should be \"$vtype complete $vtparm $vtval\""
           58  +
           59  +test vt-${vtype}-complete-1.1 "$vtype complete, wrong args, not enough" -body {
           60  +    $vtype complete P
           61  +} -returnCodes error -result "wrong # args: should be \"$vtype complete $vtparm $vtval\""
           62  +
           63  +test vt-${vtype}-complete-1.2 "$vtype complete, wrong args, too many" -body {
           64  +    $vtype complete P V X
           65  +} -returnCodes error -result "wrong # args: should be \"$vtype complete $vtparm $vtval\""
           66  +
           67  +# # ## ### ##### ######## ############# #####################
           68  +## release
           69  +
           70  +test vt-${vtype}-release-1.0 "$vtype release, wrong args, not enough" -body {
           71  +    $vtype release
           72  +} -returnCodes error -result "wrong # args: should be \"$vtype release $vtparm $vtval\""
           73  +
           74  +test vt-${vtype}-release-1.1 "$vtype release, wrong args, not enough" -body {
           75  +    $vtype release P
           76  +} -returnCodes error -result "wrong # args: should be \"$vtype release $vtparm $vtval\""
           77  +
           78  +test vt-${vtype}-release-1.2 "$vtype release, wrong args, too many" -body {
           79  +    $vtype release P V X
           80  +} -returnCodes error -result "wrong # args: should be \"$vtype release $vtparm $vtval\""
           81  +
           82  +# # ## ### ##### ######## ############# #####################
           83  +##
           84  +return