rework the way the build tests examine the output

This commit is contained in:
Josh Holtrop 2013-07-07 20:01:35 -04:00
parent 2f907ab3eb
commit 2939dc8c74

View File

@ -21,6 +21,7 @@ describe Rscons do
FileUtils.cp_r("build_tests/#{build_test_directory}", 'build_tests_run') FileUtils.cp_r("build_tests/#{build_test_directory}", 'build_tests_run')
Dir.chdir("build_tests_run") Dir.chdir("build_tests_run")
build_testdir build_testdir
get_build_output
end end
def file_sub(fname) def file_sub(fname)
@ -34,6 +35,10 @@ describe Rscons do
end end
end end
def get_build_output
File.read('build.out').lines.map(&:strip)
end
########################################################################### ###########################################################################
# Tests # Tests
########################################################################### ###########################################################################
@ -45,19 +50,19 @@ describe Rscons do
end end
it 'prints commands as they are executed' do it 'prints commands as they are executed' do
test_dir('simple') lines = test_dir('simple')
File.read('build.out').should == <<EOF lines.should == [
gcc -c -o simple.o -MMD -MF simple.mf simple.c 'gcc -c -o simple.o -MMD -MF simple.mf simple.c',
gcc -o simple simple.o 'gcc -o simple simple.o',
EOF ]
end end
it 'prints short representations of the commands being executed' do it 'prints short representations of the commands being executed' do
test_dir('header') lines = test_dir('header')
File.read('build.out').should == <<EOF lines.should == [
CC header.o 'CC header.o',
LD header 'LD header',
EOF ]
end end
it 'builds a C program with one source file and one header file' do it 'builds a C program with one source file and one header file' do