()
| 12 | |
| 13 | |
| 14 | def test_assigning_project_ids(): |
| 15 | t = BoostBuild.Tester(pass_toolset=False) |
| 16 | t.write("jamroot.jam", """\ |
| 17 | import assert ; |
| 18 | import modules ; |
| 19 | import notfile ; |
| 20 | import project ; |
| 21 | |
| 22 | rule 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. |
| 29 | assert-project-id ; # Initial project id is empty |
| 30 | project foo ; assert-project-id /foo ; |
| 31 | project ; assert-project-id /foo ; |
| 32 | project foo ; assert-project-id /foo ; |
| 33 | project bar ; assert-project-id /bar ; |
| 34 | project /foo ; assert-project-id /foo ; |
| 35 | project "" ; assert-project-id /foo ; |
| 36 | |
| 37 | # Calling the use-project rule does not modify the project's main id. |
| 38 | use-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. |
| 41 | a-module = [ project.load a ] ; |
| 42 | assert-project-id : $(a-module) ; |
| 43 | use-project id2 : a ; |
| 44 | assert-project-id : $(a-module) ; |
| 45 | modules.call-in $(a-module) : project baz ; |
| 46 | assert-project-id /baz : $(a-module) ; |
| 47 | use-project id3 : a ; |
| 48 | assert-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. |
| 53 | notfile x : @assert-a-rule ; |
| 54 | rule 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. |
| 61 | assert-project-id ; |
| 62 | """) |
| 63 | t.run_build_system() |
| 64 | t.cleanup() |
| 65 | |
| 66 | |
| 67 | def test_using_project_ids_in_target_references(): |
no test coverage detected