Index: openacs-4/packages/acs-tcl/tcl/test/ad-proc-test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/ad-proc-test-procs.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/acs-tcl/tcl/test/ad-proc-test-procs.tcl 29 Mar 2005 10:23:06 -0000 1.3 +++ openacs-4/packages/acs-tcl/tcl/test/ad-proc-test-procs.tcl 13 Jul 2006 23:19:52 -0000 1.4 @@ -58,64 +58,63 @@ ::callback::a_callback::impl::an_impl] >= 0}] } -aa_register_case -cats {api smoke} ad_proc_fire_callback { - - Tests a callback with two implementations . - -} { - ad_proc -callback a_callback { +ad_proc -callback a_callback { -arg1:required arg2 - } { +} { this is a test callback - } - +} - - ad_proc -callback b_callback { +ad_proc -callback b_callback { -arg1:required arg2 - } { +} { this is a test callback - } - - ad_proc -callback c_callback { +} - +ad_proc -callback c_callback { -arg1:required arg2 - } { +} { this is a test callback - } - +} - - aa_true "throws error for invalid arguments even if no implementations" \ - [catch {callback c_callback bar} error] - - aa_true "callback returns empty list with no implementations" \ - [expr {[llength [callback b_callback -arg1 foo bar]] == 0}] - - ad_proc -callback a_callback -impl an_impl1 {} { - this is a test callback implementation - } { +ad_proc -callback a_callback -impl an_impl1 {} { + this is a test callback implementation +} { return 1 - } +} - set foo(test) 2 - - ad_proc -callback a_callback -impl an_impl2 {} { +ad_proc -callback a_callback -impl an_impl2 {} { this is a test callback implementation which does an upvar of an array. - } { - upvar $arg1 arr - if {[info exists arr(test)]} { +} { + upvar $arg1 arr + if {[info exists arr(test)]} { return $arr(test) - } - return {} } + return {} +} - ad_proc -callback a_callback -impl fail_impl {} { - this is a test callback implementation - } { +ad_proc -callback a_callback -impl fail_impl {} { + this is a test callback implementation +} { error "should fail" - } +} - ad_proc EvilCallback {} { - error "Should not be invoked" - } +ad_proc EvilCallback {} { + error "Should not be invoked" +} +aa_register_case -cats {api smoke} ad_proc_fire_callback { + Tests a callback with two implementations . + +} { + aa_true "throws error for invalid arguments even if no implementations" \ + [catch {callback c_callback bar} error] + + aa_true "callback returns empty list with no implementations" \ + [expr {[llength [callback b_callback -arg1 foo bar]] == 0}] + + set foo(test) 2 + aa_true "callback returns value for each defined callback and catches the error callback" \ [expr {[llength [callback -catch a_callback -arg1 foo bar]] == 2}]