1#!/usr/local/bin/python3.8
2
3# Copyright 2011 Steven Watanabe
4# Copyright 2020 Rene Ferdinand Rivera Morell
5# Distributed under the Boost Software License, Version 1.0.
6# (See accompanying file LICENSE_1_0.txt or copy at
7# http://www.boost.org/LICENSE_1_0.txt)
8
9
10import BoostBuild
11
12t = BoostBuild.Tester(["-ffile.jam"], pass_toolset=0)
13
14t.write("file.jam", """\
15name = n1 n2 ;
16contents = M1 M2 ;
17EXIT "file:" "@(o$(name:J=) .txt:E= test -D$(contents))" : 0 ;
18""")
19
20t.run_build_system()
21t.expect_output_lines("file: on1n2 .txt")
22t.expect_addition("on1n2 .txt")
23t.expect_content("on1n2 .txt", " test -DM1 -DM2", True)
24
25t.rm(".")
26
27t.write("file.jam", """\
28name = n1 n2 ;
29contents = M1 M2 ;
30actions run { echo file: "@(o$(name:J=) .txt:E= test -D$(contents))" }
31run all ;
32""")
33
34t.run_build_system(["-d2"])
35t.expect_output_lines(' echo file: "on1n2 .txt" ')
36t.expect_addition("on1n2 .txt")
37t.expect_content("on1n2 .txt", " test -DM1 -DM2", True)
38
39t.rm(".")
40
41t.write("file.jam", """\
42name = n1 n2 ;
43contents = M1 M2 ;
44file = "@($(STDOUT):E= test -D$(contents)\n)" ;
45actions run { $(file) }
46run all ;
47""")
48
49t.run_build_system(["-d1"])
50t.expect_output_lines(" test -DM1 -DM2")
51
52t.rm(".")
53
54t.write("file.jam", """\
55name = n1 n2 ;
56contents = M1 M2 ;
57actions run { @($(STDOUT):E= test -D$(contents)\n) }
58run all ;
59""")
60
61t.run_build_system(["-d1"])
62t.expect_output_lines(" test -DM1 -DM2")
63
64t.cleanup()
65