begin on test infrastructure
This commit is contained in:
parent
1418907893
commit
27c65b0998
4
Makefile
4
Makefile
@ -13,3 +13,7 @@ install:
|
|||||||
.PHONY: uninstall
|
.PHONY: uninstall
|
||||||
uninstall:
|
uninstall:
|
||||||
./waf uninstall
|
./waf uninstall
|
||||||
|
|
||||||
|
.PHONY: test
|
||||||
|
test:
|
||||||
|
@(cd tests; rspec)
|
||||||
|
1
tests/Gemfile
Normal file
1
tests/Gemfile
Normal file
@ -0,0 +1 @@
|
|||||||
|
gem "rspec"
|
25
tests/Gemfile.lock
Normal file
25
tests/Gemfile.lock
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
GEM
|
||||||
|
specs:
|
||||||
|
diff-lcs (1.3)
|
||||||
|
rspec (3.6.0)
|
||||||
|
rspec-core (~> 3.6.0)
|
||||||
|
rspec-expectations (~> 3.6.0)
|
||||||
|
rspec-mocks (~> 3.6.0)
|
||||||
|
rspec-core (3.6.0)
|
||||||
|
rspec-support (~> 3.6.0)
|
||||||
|
rspec-expectations (3.6.0)
|
||||||
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
|
rspec-support (~> 3.6.0)
|
||||||
|
rspec-mocks (3.6.0)
|
||||||
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
|
rspec-support (~> 3.6.0)
|
||||||
|
rspec-support (3.6.0)
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
ruby
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
rspec
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
1.16.1
|
23
tests/spec/main_spec.rb
Normal file
23
tests/spec/main_spec.rb
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
require "fileutils"
|
||||||
|
require "open3"
|
||||||
|
|
||||||
|
describe "cxlc" do
|
||||||
|
def run_test(test_name)
|
||||||
|
stdout, stderr, status = Open3.capture3("../build/cxlc", "#{test_name}.cxl")
|
||||||
|
expect(status).to eq(0)
|
||||||
|
stdout, stderr, status = Open3.capture3("gcc", "-o", test_name, "#{test_name}.c")
|
||||||
|
if status != 0
|
||||||
|
$stderr.write(stderr)
|
||||||
|
end
|
||||||
|
expect(status).to eq(0)
|
||||||
|
stdout, stderr, status = Open3.capture3("./#{test_name}")
|
||||||
|
expect(stdout).to eq(File.read("#{test_name}.x"))
|
||||||
|
end
|
||||||
|
|
||||||
|
Dir["*.cxl"].sort.each do |test|
|
||||||
|
test_basename = File.basename(test, ".cxl")
|
||||||
|
it "passes test #{test_basename}" do
|
||||||
|
run_test(test_basename)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
6
tests/t001.cxl
Normal file
6
tests/t001.cxl
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(int argc, char * argv[])
|
||||||
|
{
|
||||||
|
printf("Working\n");
|
||||||
|
}
|
1
tests/t001.x
Normal file
1
tests/t001.x
Normal file
@ -0,0 +1 @@
|
|||||||
|
Working
|
Loading…
x
Reference in New Issue
Block a user