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 "bundler/gem_tasks"
|
||||||
require "rspec/core/rake_task"
|
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
|
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'
|
require 'fileutils'
|
||||||
|
|
||||||
describe Rscons do
|
describe Rscons do
|
||||||
FileUtils.rm_rf('build_tests/test')
|
FileUtils.rm_rf('build_test')
|
||||||
test_dirs = Dir['build_tests/*/']
|
|
||||||
test_dirs.each do |build_test_rel_path|
|
def setup_testdir(files, &blk)
|
||||||
context build_test_rel_path do
|
FileUtils.mkdir_p('build_test')
|
||||||
before do
|
files.each do |fname|
|
||||||
FileUtils.cp_r(build_test_rel_path, 'build_tests/test')
|
src = "spec/build_items/#{fname}"
|
||||||
@owd = Dir.pwd
|
dst = "build_test/#{fname}"
|
||||||
Dir.chdir('build_tests/test')
|
FileUtils.mkdir_p(File.dirname(dst))
|
||||||
$stdout.stub(:puts) { nil }
|
FileUtils.cp_r(src, dst)
|
||||||
end
|
end
|
||||||
instance_eval(File.read(File.join(build_test_rel_path, 'spec.rb')))
|
Dir.chdir('build_test', &blk)
|
||||||
after do
|
FileUtils.rm_rf('build_test')
|
||||||
Dir.chdir(@owd)
|
end
|
||||||
FileUtils.rm_rf('build_tests/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
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user