b725d7c5 |
1 | # Test procedure locate_data_file |
2 | |
3 | # add path to subdirectory tests_data to CSF_TestDataPath, |
4 | # for testing of files search procedure |
5 | set addpath [file dirname [info script]]/tests_data |
6 | if { ! [info exists env(CSF_TestDataPath)] } { |
7 | set env(CSF_TestDataPath) $addpath |
8 | } elseif { ! [regexp "$addpath" $env(CSF_TestDataPath)] } { |
9 | set env(CSF_TestDataPath) "$env(CSF_TestDataPath)[_path_separator]$addpath" |
10 | } |
11 | |
12 | puts "CSF_TestDataPath set to $env(CSF_TestDataPath)" |
13 | |
14 | # Failed search |
15 | if [catch {locate_data_file file1.empty} path] { |
16 | puts "Data file file1.empty not found, that is OK" |
17 | } else { |
18 | error "Data file file1.empty is found at $path, while it should not be" |
19 | } |
20 | |
21 | # Successful search |
22 | puts "Data file 2 found in [locate_data_file file2.empty]" |
23 | puts "Data file 3 found in [locate_data_file file3.empty]" |
24 | puts "Data file 4 found in [locate_data_file file4.empty]" |
25 | puts "Data file 5 found in [locate_data_file file5.empty]" |
26 | |
27 | # Failed search |
28 | if [catch {locate_data_file file6.empty} path] { |
29 | puts "Data file file6.empty not found, that is OK" |
30 | } else { |
31 | error "Data file file6.empty is found at $path, while it should not be" |
32 | } |
33 | |
34 | |
35 | puts "TEST COMPLETED" |