# -*- tcl -*- Include file for cmdr.test.
# # ## ### ##### ######## ############# #####################
## Basic wrong#args checks.

test cmdr-main-1.0 {new, wrong num args, not enough} -body {
    cmdr new
} -returnCodes error \
    -result {wrong # args: should be "cmdr new name spec"}

test cmdr-main-1.1 {new, wrong num args, too many} -body {
    cmdr new NAME
} -returnCodes error \
    -result {wrong # args: should be "cmdr new name spec"}

test cmdr-main-1.2 {new, wrong num args, too many} -body {
    cmdr new NAME SPEC X
} -returnCodes error \
    -result {wrong # args: should be "cmdr new name spec"}

test cmdr-main-1.3 {create, wrong num args, not enough} -body {
    cmdr create
} -returnCodes error \
    -result {wrong # args: should be "cmdr create obj name spec"}

test cmdr-main-1.4 {create, wrong num args, not enough} -body {
    cmdr create OBJ
} -returnCodes error \
    -result {wrong # args: should be "cmdr create obj name spec"}

test cmdr-main-1.5 {create, wrong num args, not enough} -body {
    cmdr create OBJ NAME
} -returnCodes error \
    -result {wrong # args: should be "cmdr create obj name spec"}

test cmdr-main-1.6 {new, wrong num args, too many} -body {
    cmdr create OBJ NAME SPEC X
} -returnCodes error \
    -result {wrong # args: should be "cmdr create obj name spec"}

# # ## ### ##### ######## ############# #####################
## Basic officer, knows nothing. create/new with proper arguments.

test cmdr-main-2.0 {new, nothing but auto-help and -exit} -setup {
    set x [cmdr new foo {}]
} -body {
    list [$x known] [$x hasdefault]
} -cleanup {
    $x destroy
    unset x
} -result {{help exit} 0}

test cmdr-main-2.1 {create, nothing but auto-help and -exit} -setup {
    cmdr create x foo {}
} -body {
    list [x known] [x hasdefault]
} -cleanup {
    x destroy
} -result {{help exit} 0}

# # ## ### ##### ######## ############# #####################
return
