From 73bc71a656fa107e8c0e55cca753f5885ffc9612 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Wed, 28 Jan 2015 17:15:55 -0500 Subject: [PATCH] test expanding paths after a build target is registered from within a build hook --- spec/build_tests_spec.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/spec/build_tests_spec.rb b/spec/build_tests_spec.rb index 337e66f..cf71107 100644 --- a/spec/build_tests_spec.rb +++ b/spec/build_tests_spec.rb @@ -778,4 +778,24 @@ EOF ]) end + it "expands target and source paths when builders are registered in build hooks" do + test_dir("build_dir") + Rscons::Environment.new do |env| + env["CPPPATH"] << "src/two" + env.Object("one.o", "src/one/one.c") + env.add_post_build_hook do |build_op| + if build_op[:target] == "one.o" + env["MODULE"] = "two" + env.Object("${MODULE}.o", "src/${MODULE}/${MODULE}.c") + end + end + end + expect(File.exists?("one.o")).to be_truthy + expect(File.exists?("two.o")).to be_truthy + expect(lines).to eq([ + "CC one.o", + "CC two.o", + ]) + end + end