mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2025-05-20 17:07:32 +08:00
- Add ability to detect TEST_FILE(“filename.c”) specifications in test files
This commit is contained in:
@ -73,6 +73,7 @@ class UnityTestRunnerGenerator
|
||||
all_files_used = [input_file, output_file]
|
||||
all_files_used += testfile_includes.map {|filename| filename + '.c'} unless testfile_includes.empty?
|
||||
all_files_used += @options[:includes] unless @options[:includes].empty?
|
||||
all_files_used += headers[:linkonly] unless headers[:linkonly].empty?
|
||||
return all_files_used.uniq
|
||||
end
|
||||
|
||||
@ -146,7 +147,8 @@ class UnityTestRunnerGenerator
|
||||
#parse out includes
|
||||
includes = {
|
||||
:local => source.scan(/^\s*#include\s+\"\s*(.+)\.[hH]\s*\"/).flatten,
|
||||
:system => source.scan(/^\s*#include\s+<\s*(.+)\s*>/).flatten.map { |inc| "<#{inc}>" }
|
||||
:system => source.scan(/^\s*#include\s+<\s*(.+)\s*>/).flatten.map { |inc| "<#{inc}>" },
|
||||
:linkonly => source.scan(/^TEST_FILE\(\s*\"\s*(.+)\.[cC]\w*\s*\"/).flatten
|
||||
}
|
||||
return includes
|
||||
end
|
||||
|
2
test/testdata/testRunnerGeneratorSmall.c
vendored
2
test/testdata/testRunnerGeneratorSmall.c
vendored
@ -4,6 +4,8 @@
|
||||
#include "unity.h"
|
||||
#include "Defs.h"
|
||||
|
||||
TEST_FILE("some_file.c")
|
||||
|
||||
/* Notes about prefixes:
|
||||
test - normal default prefix. these are "always run" tests for this procedure
|
||||
spec - normal default prefix. required to run default setup/teardown calls.
|
||||
|
Reference in New Issue
Block a user