summaryrefslogtreecommitdiff
path: root/tests/vendor/ceedling/lib/preprocessinator_file_handler.rb
diff options
context:
space:
mode:
Diffstat (limited to 'tests/vendor/ceedling/lib/preprocessinator_file_handler.rb')
-rw-r--r--tests/vendor/ceedling/lib/preprocessinator_file_handler.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/vendor/ceedling/lib/preprocessinator_file_handler.rb b/tests/vendor/ceedling/lib/preprocessinator_file_handler.rb
new file mode 100644
index 000000000..65020ed7a
--- /dev/null
+++ b/tests/vendor/ceedling/lib/preprocessinator_file_handler.rb
@@ -0,0 +1,21 @@
+
+
+class PreprocessinatorFileHandler
+
+ constructor :preprocessinator_extractor, :configurator, :tool_executor, :file_path_utils, :file_wrapper
+
+
+ def preprocess_file(filepath, includes)
+ preprocessed_filepath = @file_path_utils.form_preprocessed_file_filepath(filepath)
+
+ command = @tool_executor.build_command_line(@configurator.tools_test_file_preprocessor, filepath, preprocessed_filepath)
+ @tool_executor.exec(command[:line], command[:options])
+
+ contents = @preprocessinator_extractor.extract_base_file_from_preprocessed_expansion(preprocessed_filepath)
+
+ includes.each{|include| contents.unshift("#include \"#{include}\"")}
+
+ @file_wrapper.write(preprocessed_filepath, contents.join("\n"))
+ end
+
+end