From e58b8bd109d22c3bc6a50c33ed187e5e01d45e9f Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 23 May 2017 16:25:03 -0400 Subject: [PATCH] add integration test for Environment#run_builder --- build_tests/simple/run_builder.rb | 12 ++++++++++++ spec/build_tests_spec.rb | 10 ++++++++++ 2 files changed, 22 insertions(+) create mode 100644 build_tests/simple/run_builder.rb diff --git a/build_tests/simple/run_builder.rb b/build_tests/simple/run_builder.rb new file mode 100644 index 0000000..83fc5f9 --- /dev/null +++ b/build_tests/simple/run_builder.rb @@ -0,0 +1,12 @@ +class MyObject < Rscons::Builder + def run(options) + target, sources, cache, env, vars = options.values_at(:target, :sources, :cache, :env, :vars) + env.run_builder(env.builders["Object"], target, sources, cache, vars) + end +end + +Rscons::Environment.new do |env| + env.add_builder(MyObject.new) + env.MyObject("simple.o", "simple.c") + env.Program("simple.exe", "simple.o") +end diff --git a/spec/build_tests_spec.rb b/spec/build_tests_spec.rb index 903c85b..269d401 100644 --- a/spec/build_tests_spec.rb +++ b/spec/build_tests_spec.rb @@ -631,6 +631,16 @@ EOF ] end + it "allows a builder to call Environment#run_builder in a non-threaded manner" do + test_dir("simple") + result = run_test(rsconsfile: "run_builder.rb") + expect(result.stderr).to eq "" + expect(lines(result.stdout)).to eq [ + "CC simple.o", + "LD simple.exe", + ] + end + context "Directory builder" do it "creates the requested directory" do test_dir("simple")