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

making new flush routines work under all defined conditions.

上级 c19b5e20
......@@ -2,7 +2,7 @@
# Unity Project - A Test Framework for C
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
# [Released under MIT License. Please refer to license.txt for details]
# ==========================================
# ==========================================
# This script creates all the files with start code necessary for a new module.
# A simple module only requires a source file, header file, and test file.
......@@ -32,20 +32,20 @@ HELP_TEXT = [ "\nGENERATE MODULE\n-------- ------",
#Built in patterns
PATTERNS = { 'src' => {'' => { :inc => [] } },
'dh' => {'Driver' => { :inc => ['%1$sHardware.h'] },
'Hardware' => { :inc => [] }
'dh' => {'Driver' => { :inc => ['%1$sHardware.h'] },
'Hardware' => { :inc => [] }
},
'dih' => {'Driver' => { :inc => ['%1$sHardware.h', '%1$sInterrupt.h'] },
'dih' => {'Driver' => { :inc => ['%1$sHardware.h', '%1$sInterrupt.h'] },
'Interrupt'=> { :inc => ['%1$sHardware.h'] },
'Hardware' => { :inc => [] }
'Hardware' => { :inc => [] }
},
'mch' => {'Model' => { :inc => [] },
'mch' => {'Model' => { :inc => [] },
'Conductor'=> { :inc => ['%1$sModel.h', '%1$sHardware.h'] },
'Hardware' => { :inc => [] }
'Hardware' => { :inc => [] }
},
'mvp' => {'Model' => { :inc => [] },
'mvp' => {'Model' => { :inc => [] },
'Presenter'=> { :inc => ['%1$sModel.h', '%1$sView.h'] },
'View' => { :inc => [] }
'View' => { :inc => [] }
}
}
......@@ -63,7 +63,7 @@ void tearDown(void)
void test_%1$s_NeedToImplement(void)
{
TEST_IGNORE();
TEST_IGNORE_MESSAGE("Need to Implement %1$s");
}
]
......@@ -91,7 +91,7 @@ ARGV.each do |arg|
when /^(\w+)/
raise "ERROR: You can't have more than one Module name specified!" unless @module_name.nil?
@module_name = arg
when /^-(h|-help)/
when /^-(h|-help)/
puts HELP_TEXT
exit
else
......@@ -126,7 +126,7 @@ end
@includes.merge!(@extra_inc) unless @extra_inc.nil?
#create triad definition
TRIAD = [ { :ext => '.c', :path => @path_src, :template => TEMPLATE_SRC, :inc => :src, :boilerplate => @boilerplates[:src] },
TRIAD = [ { :ext => '.c', :path => @path_src, :template => TEMPLATE_SRC, :inc => :src, :boilerplate => @boilerplates[:src] },
{ :ext => '.h', :path => @path_inc, :template => TEMPLATE_INC, :inc => :inc, :boilerplate => @boilerplates[:inc] },
{ :ext => '.c', :path => @path_tst+'Test', :template => TEMPLATE_TST, :inc => :tst, :boilerplate => @boilerplates[:tst] },
]
......@@ -159,7 +159,7 @@ if @destroy
file = filespec[:path]
if File.exist?(file)
if @update_svn
`svn delete \"#{file}\" --force`
`svn delete \"#{file}\" --force`
puts "File #{file} deleted and removed from source control"
else
FileUtils.remove(file)
......@@ -182,13 +182,13 @@ end
files.each_with_index do |file, i|
File.open(file[:path], 'w') do |f|
f.write(file[:boilerplate] % [file[:name]]) unless file[:boilerplate].nil?
f.write(file[:template] % [ file[:name],
file[:includes].map{|f| "#include \"#{f}\"\n"}.join,
f.write(file[:template] % [ file[:name],
file[:includes].map{|f| "#include \"#{f}\"\n"}.join,
file[:name].upcase ]
)
end
if (@update_svn)
`svn add \"#{file[:path]}\"`
`svn add \"#{file[:path]}\"`
if $?.exitstatus == 0
puts "File #{file[:path]} created and added to source control"
else
......
......@@ -9,10 +9,7 @@
/* If omitted from header, declare overrideable prototypes here so they're ready for use */
#ifdef UNITY_OMIT_OUTPUT_CHAR_HEADER_DECLARATION
int UNITY_OUTPUT_CHAR(int);
#endif
#ifdef UNITY_OMIT_OUTPUT_FLUSH_HEADER_DECLARATION
int UNITY_OUTPUT_FLUSH(void);
void UNITY_OUTPUT_CHAR(int);
#endif
/* Helpful macros for us to use here */
......@@ -338,7 +335,7 @@ void UnityConcludeTest(void)
Unity.CurrentTestFailed = 0;
Unity.CurrentTestIgnored = 0;
UNITY_PRINT_EOL();
UNITY_OUTPUT_FLUSH();
UNITY_FLUSH_CALL();
}
/*-----------------------------------------------*/
......@@ -1298,7 +1295,7 @@ int UnityEnd(void)
#endif
}
UNITY_PRINT_EOL();
UNITY_OUTPUT_FLUSH();
UNITY_FLUSH_CALL();
UNITY_OUTPUT_COMPLETE();
return (int)(Unity.TestFailures);
}
......
......@@ -299,9 +299,9 @@ extern void UNITY_OUTPUT_CHAR(int);
#endif
#ifndef UNITY_OUTPUT_FLUSH
/* Default to using putchar, which is defined in stdio.h */
/* Default to using fflush, which is defined in stdio.h */
#include <stdio.h>
#define UNITY_OUTPUT_FLUSH() (void)fflush(stdout)
#define UNITY_OUTPUT_FLUSH (void)fflush(stdout)
#else
/* If defined as something else, make sure we declare it here so it's ready for use */
#ifndef UNITY_OMIT_OUTPUT_FLUSH_HEADER_DECLARATION
......@@ -309,6 +309,12 @@ extern void UNITY_OUTPUT_FLUSH(void);
#endif
#endif
#ifndef UNITY_OUTPUT_FLUSH
#define UNITY_FLUSH_CALL()
#else
#define UNITY_FLUSH_CALL() UNITY_OUTPUT_FLUSH
#endif
#ifndef UNITY_PRINT_EOL
#define UNITY_PRINT_EOL() UNITY_OUTPUT_CHAR('\n')
#endif
......
......@@ -60,6 +60,8 @@ compiler:
- UNITY_INCLUDE_DOUBLE
- UNITY_SUPPORT_TEST_CASES
- UNITY_SUPPORT_64
- UNITY_OUTPUT_FLUSH
- UNITY_OMIT_OUTPUT_FLUSH_HEADER_DECLARATION
object_files:
prefix: '-o'
extension: '.o'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册