From fc18c9f1231b5554b421ac0ecdce8e0f381b4ed9 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Fri, 16 Jan 2026 20:21:13 -0500 Subject: [PATCH] Test phony dependencies --- build_tests/typical/phonies.rb | 15 +++++++++++++++ spec/build_tests_spec.rb | 8 ++++++++ 2 files changed, 23 insertions(+) create mode 100644 build_tests/typical/phonies.rb diff --git a/build_tests/typical/phonies.rb b/build_tests/typical/phonies.rb new file mode 100644 index 0000000..718e7f6 --- /dev/null +++ b/build_tests/typical/phonies.rb @@ -0,0 +1,15 @@ +class Custom < Rscons::Builder + def run(options) + print_run_message("#{name} #{target}", nil) + true + end +end + +env do |env| + env.add_builder(Custom) + env.Custom("t3", :phony1) + env.Custom(:phony1, "t2") + env.Custom("t2", :phony2) + env.Custom(:phony2, "t1") + env.Custom("t1", []) +end diff --git a/spec/build_tests_spec.rb b/spec/build_tests_spec.rb index 293a808..f787afd 100644 --- a/spec/build_tests_spec.rb +++ b/spec/build_tests_spec.rb @@ -1347,6 +1347,14 @@ EOF %r{Checker simple.exe}, ]) end + + it "supports phony targets as dependencies" do + test_dir "typical" + result = run_rscons(args: %w[-f phonies.rb]) + expect(result.stderr).to eq "" + expect(result.status).to eq 0 + expect(result.stdout).to match /t1.*phony2.*t2.*phony1.*t3/m + end end context "Environment#clear_targets" do