_acs-tcl__export_vars (private)
_acs-tcl__export_vars
Defined in packages/acs-tcl/tcl/test/acs-tcl-test-procs.tcl
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set _aa_export {} set body_count 1 foreach testcase_body {{ set foo 1 set bar {} aa_section "Exporting plain variables" aa_equals "{ foo bar }" [export_vars { foo bar }] "foo=1&bar=" aa_equals "-no_empty { foo bar }" [export_vars -no_empty { foo bar }] "foo=1" aa_equals "-no_empty { foo bar { baz greble } }" [export_vars -no_empty { foo bar { baz greble } }] "foo=1&baz=greble" aa_equals "-no_empty -override { { bar \"\" } } { foo bar }" [export_vars -no_empty -override { { bar "" } } { foo bar }] "foo=1&bar=" aa_equals "-no_empty -override { { baz greble } } { foo bar }" [export_vars -no_empty -override { baz } { foo bar }] "foo=1" aa_equals "-no_empty { foo { bar \"\" } }" [export_vars -no_empty { foo { bar "" } }] "foo=1&bar=" aa_equals "base ending with '?', with vars" [export_vars -base "dummy?" { foo { bar "" } }] "dummy?foo=1&bar=" aa_equals "base ending with '?', no vars" [export_vars -base "dummy?"] "dummy" aa_equals "base containing more than two slashes " [export_vars -base "http://dummywebsite.com/one/two" {{foo a} {bar b}}] "http://dummywebsite.com/one/two?foo=a&bar=b" aa_equals "absolute base URL with query vars + exported vars" [export_vars -no_base_encode -base /absolute/url?param1=one¶m2=two {{exported_param exported}}] "/absolute/url?param1=one¶m2=two&exported_param=exported" aa_section "Exporting plain variables + array" array set an_array {one 1 two 2 three 3} aa_equals "{ foo bar }" [export_vars { foo bar an_array }] "foo=1&an_array.three=3&an_array.two=2&an_array.one=1&bar=" aa_equals "-no_empty { foo bar }" [export_vars -no_empty { foo bar an_array }] "foo=1&an_array.three=3&an_array.two=2&an_array.one=1" aa_equals "-no_empty { foo bar { baz greble } }" [export_vars -no_empty { foo bar { baz greble } an_array }] "foo=1&an_array.three=3&an_array.two=2&an_array.one=1&baz=greble" aa_equals "-no_empty -override { { bar {} } { an_array {} } } { foo bar an_array }" [export_vars -no_empty -override { { bar {} } { an_array {} } } { foo bar an_array }] "foo=1&an_array=&bar=" aa_equals "-no_empty -override { { baz greble } } { foo bar an_array }" [export_vars -no_empty -override { baz } { foo bar an_array }] "foo=1&an_array.three=3&an_array.two=2&an_array.one=1" aa_equals "-no_empty { foo { bar {} } { an_array {} } }" [export_vars -no_empty { foo { bar {} } { an_array {} } }] "foo=1&an_array=&bar=" aa_equals "base ending with '?', with vars" [export_vars -base "dummy?" { foo { bar {} } { an_array {} } }] "dummy?foo=1&an_array=&bar=" aa_equals "base containing more than two slashes " [export_vars -base "http://dummywebsite.com/one/two" {{foo a} {bar b} an_array}] "http://dummywebsite.com/one/two?foo=a&an_array.three=3&an_array.two=2&an_array.one=1&bar=b" aa_equals "absolute base URL with query vars + exported vars" [export_vars -no_base_encode -base /absolute/url?param1=one¶m2=two {{exported_param exported} an_array}] "/absolute/url?param1=one¶m2=two&an_array.three=3&an_array.two=2&an_array.one=1&exported_param=exported" aa_section "Exporting plain variables + multiple" set a_multiple [list first second third] aa_equals "{ foo bar }" [export_vars { foo bar a_multiple:multiple }] "a_multiple=first&a_multiple=second&a_multiple=third&foo=1&bar=" aa_equals "-no_empty { foo bar }" [export_vars -no_empty { foo bar a_multiple:multiple }] "a_multiple=first&a_multiple=second&a_multiple=third&foo=1" aa_equals "-no_empty { foo bar { baz greble } }" [export_vars -no_empty { foo bar { baz greble } a_multiple:multiple }] "a_multiple=first&a_multiple=second&a_multiple=third&foo=1&baz=greble" aa_equals "-no_empty -override { { bar {} } { a_multiple {} } } { foo bar a_multiple:multiple }" [export_vars -no_empty -override { { bar {} } { a_multiple {} } } { foo bar a_multiple:multiple }] "foo=1&a_multiple=&bar=" aa_equals "-no_empty -override { { baz greble } } { foo bar a_multiple:multiple }" [export_vars -no_empty -override { baz } { foo bar a_multiple:multiple }] "a_multiple=first&a_multiple=second&a_multiple=third&foo=1" aa_equals "-no_empty { foo { bar {} } { a_multiple {} } }" [export_vars -no_empty { foo { bar {} } { a_multiple {} } }] "a_multiple=&foo=1&bar=" aa_equals "base ending with '?', with vars" [export_vars -base "dummy?" { foo { bar {} } { a_multiple {} } }] "dummy?a_multiple=&foo=1&bar=" aa_equals "base containing more than two slashes " [export_vars -base "http://dummywebsite.com/one/two" { {foo a} {bar b} a_multiple:multiple }] "http://dummywebsite.com/one/two?a_multiple=first&a_multiple=second&a_multiple=third&foo=a&bar=b" aa_equals "absolute base URL with query vars + exported vars" [export_vars -no_base_encode -base /absolute/url?param1=one¶m2=two { {exported_param exported} a_multiple:multiple }] "/absolute/url?param1=one¶m2=two&a_multiple=first&a_multiple=second&a_multiple=third&exported_param=exported" aa_section "Misc/Cornercases" # Test base with query vars set var1 a set var2 {} set base [export_vars -base test-page { foo bar }] set export_no_base [export_vars {var1 var2}] aa_equals "base with query vars" [export_vars -base $base {var1 var2}] "$base&$export_no_base" # Test base without query vars set base test-page aa_equals "base without query vars" [export_vars -base $base {var1 var2}] "$base?$export_no_base" # Test just ad_urlencode_url (used by export_vars) set url http://example.com/example aa_equals "complex URL" [ad_urlencode_url $url] $url set url http://example.com/foo=1/bar aa_equals "complex URL with char which has to be escaped" [ad_urlencode_url $url] http://example.com/foo%3d1/bar # Test just ad_urlencode_url: location without trailing slash set url http://example.com aa_equals "URL with trailing slash" [ad_urlencode_url $url] $url/ # Test just ad_urlencode_url: location with trailing slash set url http://example.com/ aa_equals "URL without trailing slash" [ad_urlencode_url $url] $url set url http://dummywebsite.com/one/two aa_equals "base with path containing more than 1 slash" [ad_urlencode_url $url] $url # Test full qualified base without query vars set base http://example.com/example aa_equals "base without query vars" [export_vars -base $base] $base }} { aa_log "Running testcase body $body_count" set ::__aa_test_indent [info level] set catch_val [catch $testcase_body msg] if {$catch_val != 0 && $catch_val != 2} { aa_log_result "fail" "export_vars (body $body_count): Error during execution: $msg, stack trace: \n$::errorInfo" } incr body_count }XQL Not present: Generic, PostgreSQL, Oracle