Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions tests/validate.test
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,15 @@ test validate-2.1 {validator throws error} -body { #<<<
} -result 0
#>>>
test validate-2.2 {validator throws error} -body { #<<<
list [catch {
set outcome [list [catch {
parse_args::parse_args {-rating ""} {
-rating {-validate {tcl::mathop::+ 1}}
}
} r o] \
[regexp {^Validation failed for "-rating": (cannot|can't) use (non-numeric|empty) string "" as (right )?operand of "\+"$} $r] \
[dict get $o -errorcode]
[regexp {^Validation failed for "-rating": (cannot|can't) use (non-numeric|empty) string as (right )?operand of "\+"$} $r] \
[dict get $o -errorcode]]

set outcome
} -cleanup {
unset -nocomplain r o
} -result {1 1 {PARSE_ARGS VALIDATION -rating}} -match regexp
Expand Down