提交 c67a4ffc 编写于 作者: M Mark VanderVoord

- Add ability to detect TEST_FILE(“filename.c”) specifications in test files

上级 41ee499e
...@@ -73,6 +73,7 @@ class UnityTestRunnerGenerator ...@@ -73,6 +73,7 @@ class UnityTestRunnerGenerator
all_files_used = [input_file, output_file] all_files_used = [input_file, output_file]
all_files_used += testfile_includes.map {|filename| filename + '.c'} unless testfile_includes.empty? 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 += @options[:includes] unless @options[:includes].empty?
all_files_used += headers[:linkonly] unless headers[:linkonly].empty?
return all_files_used.uniq return all_files_used.uniq
end end
...@@ -146,7 +147,8 @@ class UnityTestRunnerGenerator ...@@ -146,7 +147,8 @@ class UnityTestRunnerGenerator
#parse out includes #parse out includes
includes = { includes = {
:local => source.scan(/^\s*#include\s+\"\s*(.+)\.[hH]\s*\"/).flatten, :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 return includes
end end
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "unity.h" #include "unity.h"
#include "Defs.h" #include "Defs.h"
TEST_FILE("some_file.c")
/* Notes about prefixes: /* Notes about prefixes:
test - normal default prefix. these are "always run" tests for this procedure test - normal default prefix. these are "always run" tests for this procedure
spec - normal default prefix. required to run default setup/teardown calls. spec - normal default prefix. required to run default setup/teardown calls.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册