Sha256: 29f4e81763689ea3200ee3a170adaaee35f1c06df4acee9b78a61da97dae21cf

Contents?: true

Size: 1.52 KB

Versions: 4

Compression:

Stored size: 1.52 KB

Contents


class PreprocessinatorHelper

  constructor :configurator, :test_includes_extractor, :task_invoker, :file_finder, :file_path_utils


  def preprocess_includes(test, preprocess_includes_proc)
    if (@configurator.project_use_test_preprocessor)
      preprocessed_includes_list = @file_path_utils.form_preprocessed_includes_list_filepath(test)
      preprocess_includes_proc.call( @file_finder.find_test_from_file_path(preprocessed_includes_list) )
      @test_includes_extractor.parse_includes_list(preprocessed_includes_list)
    else
      @test_includes_extractor.parse_test_file(test)
    end
  end

  def assemble_mocks_list(test)
    return @file_path_utils.form_mocks_source_filelist( @test_includes_extractor.lookup_raw_mock_list(test) )
  end

  def preprocess_mockable_headers(mock_list, preprocess_file_proc)
    if (@configurator.project_use_test_preprocessor)
      preprocess_files_smartly(
        @file_path_utils.form_preprocessed_mockable_headers_filelist(mock_list),
        preprocess_file_proc ) { |file| @file_finder.find_header_file(file) }
    end
  end

  def preprocess_test_file(test, preprocess_file_proc)
    return if (!@configurator.project_use_test_preprocessor)

    preprocess_file_proc.call(test)
  end

  private ############################

  def preprocess_files_smartly(file_list, preprocess_file_proc)
    if (@configurator.project_use_deep_dependencies)
      @task_invoker.invoke_test_preprocessed_files(file_list)
    else
      file_list.each { |file| preprocess_file_proc.call( yield(file) ) }
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ceedling-0.28.3 lib/ceedling/preprocessinator_helper.rb
ceedling-0.28.2 lib/ceedling/preprocessinator_helper.rb
ceedling-0.28.1 lib/ceedling/preprocessinator_helper.rb
ceedling-0.27.0 lib/ceedling/preprocessinator_helper.rb