From c67a4ffcf399a048040c34080358f17a65934200 Mon Sep 17 00:00:00 2001 From: Mark VanderVoord Date: Mon, 13 Mar 2017 17:23:26 -0400 Subject: [PATCH] =?UTF-8?q?-=20Add=20ability=20to=20detect=20TEST=5FFILE(?= =?UTF-8?q?=E2=80=9Cfilename.c=E2=80=9D)=20specifications=20in=20test=20fi?= =?UTF-8?q?les?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- auto/generate_test_runner.rb | 4 +++- test/testdata/testRunnerGeneratorSmall.c | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/auto/generate_test_runner.rb b/auto/generate_test_runner.rb index 5c5ead4..fbb7d9c 100644 --- a/auto/generate_test_runner.rb +++ b/auto/generate_test_runner.rb @@ -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 diff --git a/test/testdata/testRunnerGeneratorSmall.c b/test/testdata/testRunnerGeneratorSmall.c index 9f4ec19..c683749 100644 --- a/test/testdata/testRunnerGeneratorSmall.c +++ b/test/testdata/testRunnerGeneratorSmall.c @@ -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. -- GitLab