_acs-tcl__csv_foreach (private)
_acs-tcl__csv_foreach
Defined in packages/acs-tcl/tcl/test/openacs-kernel-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 {{ aa_run_with_teardown -test_code { # Create CSV file set file_loc "[ad_tmpdir]/test.csv" set file_id [open $file_loc w] puts $file_id "first_name,last_name,instrument" puts $file_id "Charles,Mingus,Bass" puts $file_id "Miles,Davis,Trumpet" puts $file_id "Jhon,Coltrane,Saxo" puts $file_id "Charlie,Parker,Saxo" puts $file_id "Thelonius,Monk,Piano" close $file_id set csv_data "\nfirst_name,last_name,instrument\nCharles,Mingus,Bass\nMiles,Davis,Trumpet\nJhon,Coltrane,Saxo\nCharlie,Parker,Saxo\nThelonius,Monk,Piano" aa_log "CSV file created with artists data:\n $csv_data" set artist_list {} oacs_util::csv_foreach -file $file_loc -array_name row { lappend artist_list "$row(first_name) $row(last_name) - $row(instrument)" } aa_equals "Getting artists from CSV file" $artist_list {{Charles Mingus - Bass} {Miles Davis - Trumpet} {Jhon Coltrane - Saxo} {Charlie Parker - Saxo} {Thelonius Monk - Piano}} } -teardown_code { file delete -force -- $file_loc } }} { 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" "csv_foreach (body $body_count): Error during execution: $msg, stack trace: \n$::errorInfo" } incr body_count }XQL Not present: Generic, PostgreSQL, Oracle