1-
21function on_test ()
32 local post_update_schedule = world .get_schedule_by_name (" PostUpdate" )
4-
3+
54 local test_system = post_update_schedule :get_system_by_name (" on_test_post_update" )
6-
5+
6+ local script_attachment = ScriptAttachment .new_entity_script (entity , script_asset )
7+
78 local system_a = world .add_system (
89 post_update_schedule ,
9- system_builder (" custom_system_a" , script_id )
10- :after (test_system )
10+ system_builder (" custom_system_a" , script_attachment )
11+ :after (test_system )
1112 )
12-
13+
1314 local system_b = world .add_system (
1415 post_update_schedule ,
15- system_builder (" custom_system_b" , script_id )
16- :after (test_system )
17- )
16+ system_builder (" custom_system_b" , script_attachment )
17+ :after (test_system )
18+ )
1819
1920 -- generate a schedule graph and verify it's what we expect
2021 local dot_graph = post_update_schedule :render_dot ()
2122
2223 local expected_dot_graph = [[
2324digraph {
2425 node_0 [label="bevy_mod_scripting_core::bindings::allocator::garbage_collector"];
25- node_1 [label="on_test_post_update "];
26- node_2 [label="script_integration_test_harness::dummy_before_post_update_system "];
27- node_3 [label="script_integration_test_harness::dummy_post_update_system "];
26+ node_1 [label="script_integration_test_harness::dummy_before_post_update_system "];
27+ node_2 [label="script_integration_test_harness::dummy_post_update_system "];
28+ node_3 [label="on_test_post_update "];
2829 node_4 [label="custom_system_a"];
2930 node_5 [label="custom_system_b"];
3031 node_6 [label="SystemSet GarbageCollection"];
@@ -33,11 +34,10 @@ digraph {
3334 node_0 -> node_6 [color=red, label="child of", arrowhead=diamond];
3435 node_4 -> node_7 [color=red, label="child of", arrowhead=diamond];
3536 node_5 -> node_8 [color=red, label="child of", arrowhead=diamond];
36- node_1 -> node_4 [color=blue, label="runs before", arrowhead=normal];
37- node_1 -> node_5 [color=blue, label="runs before", arrowhead=normal];
38- node_2 -> node_3 [color=blue, label="runs before", arrowhead=normal];
37+ node_1 -> node_2 [color=blue, label="runs before", arrowhead=normal];
38+ node_3 -> node_4 [color=blue, label="runs before", arrowhead=normal];
39+ node_3 -> node_5 [color=blue, label="runs before", arrowhead=normal];
3940}
4041 ]]
41-
4242 assert_str_eq (dot_graph , expected_dot_graph , " Expected the schedule graph to match the expected graph" )
4343end
0 commit comments