From: Michael D. Lowis Date: Tue, 15 Jul 2014 01:25:20 +0000 (-0400) Subject: Update rakefile to build tests and library. Also fixed a warning in the library X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=d9c652a8c8843297f8dbf41d6be9445f794950fb;p=projs%2Fopts.git Update rakefile to build tests and library. Also fixed a warning in the library --- diff --git a/Rakefile b/Rakefile index 62f6cf7..9c69c30 100644 --- a/Rakefile +++ b/Rakefile @@ -7,19 +7,21 @@ desc "Force the build to build in Posix mode" task(:posix){ is_windows = false } base = Rscons::Environment.new do |env| - #env["CFLAGS"] += ['-Wall', '-Werror'] + env["CFLAGS"] += ['-Wall', '-Werror'] env['CXXSUFFIX'] = '.cpp' end -task :default => [:staticlib] +task :default => [:test, :build] task :build => [:staticlib] +desc "Run all unit tests" task :test => [:unittest_pp] do base.clone do |env| - env['CPPFLAGS'] << 'tools/UnitTest++/src/' - env.Program('build/test_libopts', Dir['source/**/*.{c,cpp}', "tests/**/*.{c,cpp}"]) - end.process + env['CPPPATH'] += ['tools/UnitTest++/src/', 'source/'] + env.Program('build/test_libopts', Dir['source/**/*.{c,cpp}', "tests/**/*.{c,cpp}", 'build/UnitTest++.a']) + end.process + sh "build/test_libopts" end desc "Build the OPTS static library" diff --git a/source/opts.c b/source/opts.c index 1fd3314..f4713b0 100644 --- a/source/opts.c +++ b/source/opts.c @@ -201,7 +201,7 @@ void OPTS_AddOption( Result_T* res, char* name, char* arg ) } } -char OPTS_ConsumeWhitespace( StreamContext_T* ctx ) +void OPTS_ConsumeWhitespace( StreamContext_T* ctx ) { while( ' ' == ctx->current ) { diff --git a/source/opts.h b/source/opts.h index bfa9d16..e922db6 100644 --- a/source/opts.h +++ b/source/opts.h @@ -71,7 +71,7 @@ char* OPTS_NextToken( StreamContext_T* ctx ); void OPTS_AddOption( Result_T* res, char* name, char* arg ); -char OPTS_ConsumeWhitespace( StreamContext_T* ctx ); +void OPTS_ConsumeWhitespace( StreamContext_T* ctx ); char OPTS_NextCharacter( StreamContext_T* ctx );