Reorganize build tests structure
This commit is contained in:
parent
488b754f4d
commit
8af27d7775
4
Rakefile
4
Rakefile
@ -1,6 +1,8 @@
|
||||
require "bundler/gem_tasks"
|
||||
require "rspec/core/rake_task"
|
||||
|
||||
RSpec::Core::RakeTask.new(:spec)
|
||||
RSpec::Core::RakeTask.new(:spec) do |t|
|
||||
t.fail_on_error = false
|
||||
end
|
||||
|
||||
task :default => :spec
|
||||
|
@ -1,6 +0,0 @@
|
||||
it 'builds a C program with one source file' do
|
||||
env = Rscons::Environment.new
|
||||
env.Program('simple', 'simple.c')
|
||||
File.exist?('simple.o').should be_true
|
||||
`./simple`.should =~ /This is a simple C program/
|
||||
end
|
@ -1,21 +1,34 @@
|
||||
require 'fileutils'
|
||||
|
||||
describe Rscons do
|
||||
FileUtils.rm_rf('build_tests/test')
|
||||
test_dirs = Dir['build_tests/*/']
|
||||
test_dirs.each do |build_test_rel_path|
|
||||
context build_test_rel_path do
|
||||
before do
|
||||
FileUtils.cp_r(build_test_rel_path, 'build_tests/test')
|
||||
@owd = Dir.pwd
|
||||
Dir.chdir('build_tests/test')
|
||||
$stdout.stub(:puts) { nil }
|
||||
end
|
||||
instance_eval(File.read(File.join(build_test_rel_path, 'spec.rb')))
|
||||
after do
|
||||
Dir.chdir(@owd)
|
||||
FileUtils.rm_rf('build_tests/test')
|
||||
end
|
||||
FileUtils.rm_rf('build_test')
|
||||
|
||||
def setup_testdir(files, &blk)
|
||||
FileUtils.mkdir_p('build_test')
|
||||
files.each do |fname|
|
||||
src = "spec/build_items/#{fname}"
|
||||
dst = "build_test/#{fname}"
|
||||
FileUtils.mkdir_p(File.dirname(dst))
|
||||
FileUtils.cp_r(src, dst)
|
||||
end
|
||||
Dir.chdir('build_test', &blk)
|
||||
FileUtils.rm_rf('build_test')
|
||||
end
|
||||
|
||||
before do
|
||||
$stdout.stub(:puts) { nil }
|
||||
end
|
||||
|
||||
###########################################################################
|
||||
# Build Tests
|
||||
###########################################################################
|
||||
|
||||
it 'builds a C program with one source file' do
|
||||
setup_testdir(['simple.c']) do
|
||||
env = Rscons::Environment.new
|
||||
env.Program('simple', 'simple.c')
|
||||
File.exist?('simple.o').should be_true
|
||||
`./simple`.should =~ /This is a simple C program/
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user