Index: openacs-4/packages/xowf/tcl/xowf-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/tcl/xowf-procs.tcl,v diff -u -r1.26 -r1.27 --- openacs-4/packages/xowf/tcl/xowf-procs.tcl 18 Jul 2018 22:33:25 -0000 1.26 +++ openacs-4/packages/xowf/tcl/xowf-procs.tcl 7 Oct 2018 11:39:57 -0000 1.27 @@ -924,43 +924,7 @@ } namespace eval ::xowf { - WorkflowConstruct instforward true set "" 1 - WorkflowConstruct instforward false set "" 0 - proc ? {cmd expected {msg ""}} { - ::xo::Timestamp t1 - set r [uplevel $cmd] - if {$msg eq ""} {set msg $cmd} - if {$r ne $expected} { - regsub -all \# $r "" r - append ::_ "Error: $msg returned \n'$r' ne \n'$expected'\n" - } else { - append ::_ "$msg - passed ([t1 diff] ms)\n" - } - } - - if {0} { - # - # some test cases - # - WorkflowConstruct x - set ::_ "" - ? {x get_value ""} "" - ? {x get_value a} a - ? {x get_value {a b}} {a b} - ? {x get_value "a b"} {a b} - ? {x get_value "? true a default b"} {a} - ? {x get_value "? false a default b"} {b} - ? {x get_value "? true {a b} default {b c}"} {a b} - ? {x get_value "? false {a b} default {b c}"} {b c} - ? {x get_value_set "? false {a b} default {b c}"} {a b c} - ns_log notice "--Test returns $::_" - } -} - - -namespace eval ::xowf { - Class create State -superclass WorkflowConstruct -parameter { {actions ""} {view_method ""} Index: openacs-4/packages/xowf/tcl/test/xowf-test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/tcl/test/xowf-test-procs.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/xowf/tcl/test/xowf-test-procs.tcl 31 Jul 2018 11:54:01 -0000 1.10 +++ openacs-4/packages/xowf/tcl/test/xowf-test-procs.tcl 7 Oct 2018 11:39:58 -0000 1.11 @@ -222,6 +222,35 @@ } } + + + aa_register_case -cats {api} -procs { + "::xowf::WorkflowConstruct instproc get_value" + } workflow_constructs { + + Test behavour of conditional and non-conditional expressions + of WorkflowConstructs. + + } { + + ::xowf::WorkflowConstruct instforward true set "" 1 + ::xowf::WorkflowConstruct instforward false set "" 0 + + ::xowf::WorkflowConstruct x + + aa_equals "non-conditional test with empty" [x get_value ""] "" + aa_equals "non-conditional test with non-empty scalar" [x get_value "a"] "a" + + aa_equals "non-conditional test with non-empty list" [x get_value {a b}] "a b" + aa_equals "non-conditional test with non-empty list" [x get_value "a b"] "a b" + + aa_equals "conditional test, true branch" [x get_value "? true a default b"] "a" + aa_equals "conditional test, false branch" [x get_value "? false a default b"] "b" + + aa_equals "conditional test, true branch list" [x get_value "? true {a b} default {b c}"] "a b" + aa_equals "conditional test, false branch list" [x get_value "? false {a b} default {b c}"] "b c" + } + } #