Index: openacs-4/packages/acs-tcl/tcl/test/memoizing-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/memoizing-procs.tcl,v diff -u -N -r1.4.2.1 -r1.4.2.2 --- openacs-4/packages/acs-tcl/tcl/test/memoizing-procs.tcl 3 Jul 2020 07:27:29 -0000 1.4.2.1 +++ openacs-4/packages/acs-tcl/tcl/test/memoizing-procs.tcl 26 Dec 2020 16:17:55 -0000 1.4.2.2 @@ -32,24 +32,45 @@ -cats {api smoke} \ -procs {util_memoize util_memoize_cached_p} \ util_memoize_cache { - Test cache of a proc executed before + Test caching of a cmd call } { - aa_log "caching a proc" - util_memoize {memoizing_procs_test::return_string -name "foobar"} + aa_log "caching a cmd call" + util_memoize {memoizing_procs_test::return_string -name "foobar"} aa_log "checking if the proc is cached" set success_p [util_memoize_cached_p {memoizing_procs_test::return_string -name "foobar"}] - aa_equals "proc was cached successful" $success_p 1 + aa_equals "cmd call was cached successful" $success_p 1 } aa_register_case \ -cats {api smoke} \ + -bugs {3448} \ + -procs {util_memoize util_memoize_cached_p} \ + util_memoize_cache_script { + Test passing a script to util_memoize. + } { + aa_log "caching a script" + set script { + set x 1 + set y 2 + expr {$x + $y} + } + set r [util_memoize $script] + aa_equals "the script was executed successfully via util_memoize" $r 3 + + set success_p [util_memoize_cached_p $script] + aa_equals "the script is recognized as being cached" $success_p 1 + } + + +aa_register_case \ + -cats {api smoke} \ -procs {util_memoize util_memoize_cached_p util_memoize_flush_regexp} \ util_memoize_cache_flush { Test flush of a proc cached } { aa_log "caching" - util_memoize {memoizing_procs_test::return_string -name "foobar"} + util_memoize {memoizing_procs_test::return_string -name "foobar"} aa_log "checking if the proc is cached" aa_log "flushing" util_memoize_flush_regexp {return_upper_case_text}