Skip to content

Commit

Permalink
Add minimal test for regex.grep.
Browse files Browse the repository at this point in the history
  • Loading branch information
grafikrobot committed Aug 19, 2023
1 parent 8053b4a commit 4f13797
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
44 changes: 44 additions & 0 deletions test/grep.py
Original file line number Diff line number Diff line change
@@ -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 <b.hpp>
""")
t.write("b.hpp", """
#include <a>
""")

t.run_build_system()
t.expect_output_lines([
"a.cpp #include <b.hpp>",
"b.hpp #include <a>",
"a.cpp include b.hpp",
"b.hpp include a",
])
t.expect_nothing_more()

t.cleanup()
1 change: 1 addition & 0 deletions test/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ def reorder_tests(tests, first_test):
"flags",
"generator_selection",
"generators_test",
"grep",
"implicit_dependency",
"indirect_conditional",
"inherit_toolset",
Expand Down

0 comments on commit 4f13797

Please sign in to comment.