Class: GeneratorTestRunner

Inherits:
Object show all
Defined in:
lib/ceedling/generator_test_runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config:, test_file_contents:, preprocessed_file_contents: nil) ⇒ GeneratorTestRunner

This class is not within any DIY context. It is instantiated on demand for each test file processed in a build.



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/ceedling/generator_test_runner.rb', line 19

def initialize(config:, test_file_contents:, preprocessed_file_contents:nil)
  @unity_runner_generator = UnityTestRunnerGenerator.new( config )
  
  # Reduced information set
  @test_cases = []

  # Full information set used for runner generation
  @test_cases_internal = []

  parse_test_file( test_file_contents, preprocessed_file_contents )
end

Instance Attribute Details

#test_casesObject

Returns the value of attribute test_cases.



12
13
14
# File 'lib/ceedling/generator_test_runner.rb', line 12

def test_cases
  @test_cases
end

Instance Method Details

#generate(module_name:, runner_filepath:, mock_list:, test_file_includes:, header_extension:) ⇒ Object



31
32
33
34
35
36
37
38
39
40
# File 'lib/ceedling/generator_test_runner.rb', line 31

def generate(module_name:, runner_filepath:, mock_list:, test_file_includes:, header_extension:)
  # Actually build the test runner using Unity's test runner generator.
  @unity_runner_generator.generate(
    module_name,
    runner_filepath,
    @test_cases_internal,
    mock_list.map{ |mock| mock + header_extension },
    test_file_includes.map{|f| File.basename(f,'.*') + header_extension}
  )
end