test command echoing
This commit is contained in:
parent
1eb9008885
commit
03f8f56858
@ -39,6 +39,7 @@ module Rscons
|
||||
(@variables[:builders] || []).each do |builder|
|
||||
add_builder(builder)
|
||||
end
|
||||
@variables[:echo] ||= :command
|
||||
end
|
||||
|
||||
def add_builder(builder)
|
||||
@ -117,9 +118,9 @@ module Rscons
|
||||
end
|
||||
end
|
||||
command = expand_varref.call(command.flatten).flatten
|
||||
if @echo == :command
|
||||
if @variables[:echo] == :command
|
||||
puts command.map { |c| c =~ /\s/ ? "'#{c}'" : c }.join(' ')
|
||||
elsif @echo == :short
|
||||
elsif @variables[:echo] == :short
|
||||
puts short_desc
|
||||
end
|
||||
system(*command)
|
||||
|
@ -13,7 +13,7 @@ describe Rscons do
|
||||
|
||||
def build_testdir
|
||||
if File.exists?("build.rb")
|
||||
system("ruby -I #{@owd}/lib -r rscons build.rb")
|
||||
system("ruby -I #{@owd}/lib -r rscons build.rb > build.out")
|
||||
end
|
||||
end
|
||||
|
||||
@ -44,6 +44,14 @@ describe Rscons do
|
||||
`./simple`.should == "This is a simple C program\n"
|
||||
end
|
||||
|
||||
it 'prints commands as they are executed' do
|
||||
test_dir('simple')
|
||||
File.read('build.out').should == <<EOF
|
||||
gcc -c -o simple.o -MMD -MF simple.mf simple.c
|
||||
gcc -o simple simple.o
|
||||
EOF
|
||||
end
|
||||
|
||||
it 'builds a C program with one source file and one header file' do
|
||||
test_dir('header')
|
||||
File.exists?('header.o').should be_true
|
||||
|
Loading…
x
Reference in New Issue
Block a user