Sha256: 04ceee60cfda60a2caddcad9e403f07743a901a0e37ac9c2a4360563908090e9

Contents?: true

Size: 1.44 KB

Versions: 6

Compression:

Stored size: 1.44 KB

Contents

require File.dirname(__FILE__) + '/../unit_test_helper'
require 'ceedling/preprocessinator_file_handler'


class PreprocessinatorFileHandlerTest < Test::Unit::TestCase

  def setup
    objects = create_mocks(:preprocessinator_extractor, :configurator, :tool_executor, :file_path_utils, :file_wrapper)
    @preprocessinator_file_handler = PreprocessinatorFileHandler.new(objects)
  end

  def teardown
  end
  
  
  should "preprocess a file" do
    create_mock(:tool_config)

    expected_file = %Q[
      #include "other_file.h"
      #include "file.h"
      #include "protobuf.pb-c.h"
      
      void foo(void)
      {
      }
      ].left_margin(0)

    @file_path_utils.expects.form_preprocessed_file_path('project/source/file.c').returns('project/build/preprocessed/files/file.c')
    @configurator.expects.tools_file_preprocessor.returns(@tool_config)
    @tool_executor.expects.build_command_line(@tool_config, 'project/source/file.c', 'project/build/preprocessed/files/file.c').returns('boring command line')
    @tool_executor.expects.exec('boring command line').returns('')
    @preprocessinator_extractor.expects.extract_base_file_from_preprocessed_expansion('project/build/preprocessed/files/file.c').returns(['', 'void foo(void)', '{', '}'])
    @file_wrapper.expects.write('project/build/preprocessed/files/file.c', expected_file.strip)

    @preprocessinator_file_handler.preprocess_file('project/source/file.c', ['file.h', 'other_file.h'])
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ceedling-0.25.0 test_graveyard/unit/busted/preprocessinator_file_handler_test.rb
ceedling-0.24.0 test_graveyard/unit/busted/preprocessinator_file_handler_test.rb
ceedling-0.22.0 test_graveyard/unit/busted/preprocessinator_file_handler_test.rb
ceedling-0.21.0 test_graveyard/unit/busted/preprocessinator_file_handler_test.rb
ceedling-0.20.3 test_graveyard/unit/busted/preprocessinator_file_handler_test.rb
ceedling-0.20.2 test_graveyard/unit/busted/preprocessinator_file_handler_test.rb