MCPcopy Create free account
hub / github.com/boostorg/build / test_assigning_project_ids

Function test_assigning_project_ids

v2/test/project_id.py:14–64  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12
13
14def test_assigning_project_ids():
15 t = BoostBuild.Tester(pass_toolset=False)
16 t.write("jamroot.jam", """\
17import assert ;
18import modules ;
19import notfile ;
20import project ;
21
22rule assert-project-id ( id ? : module-name ? )
23{
24 module-name ?= [ CALLER_MODULE ] ;
25 assert.result $(id) : project.attribute $(module-name) id ;
26}
27
28# Project rule modifies the main project id.
29assert-project-id ; # Initial project id is empty
30project foo ; assert-project-id /foo ;
31project ; assert-project-id /foo ;
32project foo ; assert-project-id /foo ;
33project bar ; assert-project-id /bar ;
34project /foo ; assert-project-id /foo ;
35project "" ; assert-project-id /foo ;
36
37# Calling the use-project rule does not modify the project's main id.
38use-project id1 : a ;
39# We need to load the 'a' Jamfile module manually as the use-project rule will
40# only schedule the load to be done after the current module load finishes.
41a-module = [ project.load a ] ;
42assert-project-id : $(a-module) ;
43use-project id2 : a ;
44assert-project-id : $(a-module) ;
45modules.call-in $(a-module) : project baz ;
46assert-project-id /baz : $(a-module) ;
47use-project id3 : a ;
48assert-project-id /baz : $(a-module) ;
49
50# Make sure the project id still holds after all the scheduled use-project loads
51# complete. We do this by scheduling the assert for the Jam action scheduling
52# phase.
53notfile x : @assert-a-rule ;
54rule assert-a-rule ( target : : properties * )
55{
56 assert-project-id /baz : $(a-module) ;
57}
58""")
59 t.write("a/jamfile.jam", """\
60# Initial project id for this module is empty.
61assert-project-id ;
62""")
63 t.run_build_system()
64 t.cleanup()
65
66
67def test_using_project_ids_in_target_references():

Callers 1

project_id.pyFile · 0.85

Calls 3

writeMethod · 0.95
run_build_systemMethod · 0.95
cleanupMethod · 0.95

Tested by

no test coverage detected