Index: openacs-4/packages/acs-templating/tcl/test/data-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/test/Attic/data-procs.tcl,v diff -u -r1.1.2.21 -r1.1.2.22 --- openacs-4/packages/acs-templating/tcl/test/data-procs.tcl 30 Jun 2021 07:47:51 -0000 1.1.2.21 +++ openacs-4/packages/acs-templating/tcl/test/data-procs.tcl 30 Jun 2021 08:17:00 -0000 1.1.2.22 @@ -523,6 +523,32 @@ } } +aa_register_case -cats { + api + smoke + production_safe +} -procs { + template::data::validate + template::data::validate::oneof +} validate_oneof { + Test validation for oneof data types + + @author Héctor Romojaro + @creation-date 30 June 2021 +} { + set message "" + set values "" + array set element {options {{zero 0} {one 1} {two 2} {three 3}}} + set value_true {0 1 2 3} + set value_false {zero null nope 4 ""} + foreach value $value_true { + aa_true "Is $value in the list of values?" [template::data::validate oneof value message] + } + foreach value $value_false { + aa_false "Is $value in the list of values?" [template::data::validate oneof value message] + } +} + # Local variables: # mode: tcl # tcl-indent-level: 4