Skip to content

Runner generation using generate_test_runner.rb does not work with fixtures. #789

@twbje

Description

@twbje

We are using fixtures, but unfortunately the runner generation using generate_test_runner.rb is not working anymore. It simply does not find any test. This seems to be due to the regular expressions, that are used to find tests in the code. So e.g.

TEST(PassiveTimer, can_detect_expired_timers) {

is not detected as a test, unless you manually add a line

void TEST_PassiveTimer_can_detect_expired_timers_(void);

as well. This is actually the preprocessor macro expansion, the TEST macro does perform. So far I could fix it locally by adding an additional replacement in the find_tests method UnityTestRunnerGenerator class:

  # resolve fixtures if found
  line = line.gsub(/TEST\s*\(\s*([A-Za-z_][A-Za-z0-9_]*)\s*\s*,\s*([A-Za-z_][A-Za-z0-9_]*)\s*\)/, 'void ' + @options[:test_prefix] + '\1_\2_(void)')

The line above simply perfoms the same expansion, the preprocessor would do anyway. Is this the right approach? Or am I using it totally wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions