diff --git a/test/grep.py b/test/grep.py new file mode 100644 index 0000000000..36d16cc68b --- /dev/null +++ b/test/grep.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 + +# Copyright 2023 René Ferdinand Rivera Morell +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt) + +import os +import BoostBuild + +t = BoostBuild.Tester(pass_toolset=False) + +t.write("Jamroot", """ +import regex ; +local a = [ regex.grep . : *.*pp : "#(include) <([^>]+)>" ] ; +while $(a) +{ + ECHO $(a[1]:D=) $(a[2]) ; + a = $(a[3-]) ; +} +local b = [ regex.grep . : *.*pp : "#(include) <([^>]+)>" : 1 2 ] ; +while $(b) +{ + ECHO $(b[1]:D=) $(b[2-3]) ; + b = $(b[4-]) ; +} +EXIT : 0 ; +""") +t.write("a.cpp", """ +#include +""") +t.write("b.hpp", """ +#include +""") + +t.run_build_system() +t.expect_output_lines([ + "a.cpp #include ", + "b.hpp #include ", + "a.cpp include b.hpp", + "b.hpp include a", +]) +t.expect_nothing_more() + +t.cleanup() diff --git a/test/test_all.py b/test/test_all.py index 73e8a7225c..a5f1d84338 100755 --- a/test/test_all.py +++ b/test/test_all.py @@ -306,6 +306,7 @@ def reorder_tests(tests, first_test): "flags", "generator_selection", "generators_test", + "grep", "implicit_dependency", "indirect_conditional", "inherit_toolset",