Class: GeneratorTestRunner

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

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



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

def initialize(config:, test_file_contents:, preprocessed_file_contents: nil, parsing_parcels:)
  @unity_runner_generator = UnityTestRunnerGenerator.new( config )
  @parsing_parcels = parsing_parcels

  # 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.



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

def test_cases
  @test_cases
end

Instance Method Details

#generate(module_name:, runner_filepath:, mocks:, includes:) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/ceedling/generators/generator_test_runner.rb', line 33

def generate(module_name:, runner_filepath:, mocks:, includes:)
  # Actually build the test runner using Unity's test runner generator.
  @unity_runner_generator.generate(
    module_name,
    runner_filepath,
    @test_cases_internal,
    # Small hack for mock subdirectory support until include paths fully supported
    mocks.map{ |include| include.filepath },
    includes.map{ |include| include.filename }
  )
end