| 1 | import os |
| 2 | |
| 3 | const tmpl_dir_name = 'templates' |
| 4 | const tmpl_file_name = 'comptime_call_tmpl_composed_path_test.txt' |
| 5 | const tmpl_plus_path = tmpl_dir_name + '/' + tmpl_file_name |
| 6 | const tmpl_separator_path = tmpl_dir_name + os.path_separator + tmpl_file_name |
| 7 | const tmpl_joined_path = os.join_path(tmpl_dir_name, tmpl_file_name) |
| 8 | |
| 9 | fn test_comptime_tmpl_resolves_plus_path_const() { |
| 10 | value := 'plus' |
| 11 | rendered := $tmpl(tmpl_plus_path) |
| 12 | assert rendered.contains(value) |
| 13 | } |
| 14 | |
| 15 | fn test_comptime_tmpl_resolves_path_separator_const() { |
| 16 | value := 'separator' |
| 17 | rendered := $tmpl(tmpl_separator_path) |
| 18 | assert rendered.contains(value) |
| 19 | } |
| 20 | |
| 21 | fn test_comptime_tmpl_resolves_join_path_const() { |
| 22 | value := 'joined const' |
| 23 | rendered := $tmpl(tmpl_joined_path) |
| 24 | assert rendered.contains(value) |
| 25 | } |
| 26 | |
| 27 | fn test_comptime_tmpl_resolves_join_path_variable() { |
| 28 | value := 'joined var' |
| 29 | tmpl_path := os.join_path(tmpl_dir_name, tmpl_file_name) |
| 30 | rendered := $tmpl(tmpl_path) |
| 31 | assert rendered.contains(value) |
| 32 | } |
| 33 | |