@@ -2,39 +2,39 @@ use crate::language::{Attribute, Identifier, Span};
22use crate :: runner:: path:: { PathSegment , QualifiedPath } ;
33
44#[ test]
5- fn empty_stack_renders_empty_string ( ) {
5+ fn empty_stack_renders_root ( ) {
66 let stack = QualifiedPath :: new ( ) ;
7- assert_eq ! ( stack. render( ) , "" ) ;
7+ assert_eq ! ( stack. render( ) , "/ " ) ;
88}
99
1010#[ test]
1111fn single_section_renders_numeral ( ) {
1212 let mut stack = QualifiedPath :: new ( ) ;
1313 stack. push ( PathSegment :: Section ( "I" ) ) ;
14- assert_eq ! ( stack. render( ) , "I" ) ;
14+ assert_eq ! ( stack. render( ) , "/ I" ) ;
1515}
1616
1717#[ test]
1818fn section_then_step_joins_with_slash ( ) {
1919 let mut stack = QualifiedPath :: new ( ) ;
2020 stack. push ( PathSegment :: Section ( "I" ) ) ;
2121 stack. push ( PathSegment :: DependentStep ( "2" ) ) ;
22- assert_eq ! ( stack. render( ) , "I/2" ) ;
22+ assert_eq ! ( stack. render( ) , "/ I/2" ) ;
2323}
2424
2525#[ test]
2626fn dependent_substep_chain ( ) {
2727 let mut stack = QualifiedPath :: new ( ) ;
2828 stack. push ( PathSegment :: DependentStep ( "2" ) ) ;
2929 stack. push ( PathSegment :: DependentStep ( "a" ) ) ;
30- assert_eq ! ( stack. render( ) , "2/a" ) ;
30+ assert_eq ! ( stack. render( ) , "/ 2/a" ) ;
3131}
3232
3333#[ test]
3434fn parallel_step_uses_dash_prefix ( ) {
3535 let mut stack = QualifiedPath :: new ( ) ;
3636 stack. push ( PathSegment :: ParallelStep ( 3 ) ) ;
37- assert_eq ! ( stack. render( ) , "-3" ) ;
37+ assert_eq ! ( stack. render( ) , "/ -3" ) ;
3838}
3939
4040#[ test]
@@ -46,7 +46,7 @@ fn attribute_frame_composes_role_and_place() {
4646 let mut stack = QualifiedPath :: new ( ) ;
4747 stack. push ( PathSegment :: Attributes ( & frame) ) ;
4848 stack. push ( PathSegment :: DependentStep ( "a" ) ) ;
49- assert_eq ! ( stack. render( ) , "@chef^kitchen/a" ) ;
49+ assert_eq ! ( stack. render( ) , "/ @chef^kitchen/a" ) ;
5050}
5151
5252#[ test]
@@ -61,7 +61,7 @@ fn nested_attribute_frames_each_contribute_a_segment() {
6161 stack. push ( PathSegment :: Attributes ( & outer) ) ;
6262 stack. push ( PathSegment :: Attributes ( & inner) ) ;
6363 stack. push ( PathSegment :: DependentStep ( "a" ) ) ;
64- assert_eq ! ( stack. render( ) , "2/@team/@chef^kitchen/a" ) ;
64+ assert_eq ! ( stack. render( ) , "/ 2/@team/@chef^kitchen/a" ) ;
6565}
6666
6767#[ test]
@@ -72,7 +72,7 @@ fn reset_role() {
7272 stack. push ( PathSegment :: DependentStep ( "1" ) ) ;
7373 stack. push ( PathSegment :: Attributes ( & frame) ) ;
7474 stack. push ( PathSegment :: DependentStep ( "a" ) ) ;
75- assert_eq ! ( stack. render( ) , "1/a" ) ;
75+ assert_eq ! ( stack. render( ) , "/ 1/a" ) ;
7676
7777 // A sibling Place attribute in the same frame still renders.
7878 let frame = vec ! [
@@ -83,34 +83,39 @@ fn reset_role() {
8383 stack. push ( PathSegment :: DependentStep ( "1" ) ) ;
8484 stack. push ( PathSegment :: Attributes ( & frame) ) ;
8585 stack. push ( PathSegment :: DependentStep ( "a" ) ) ;
86- assert_eq ! ( stack. render( ) , "1/^kitchen/a" ) ;
86+ assert_eq ! ( stack. render( ) , "/ 1/^kitchen/a" ) ;
8787}
8888
8989#[ test]
9090fn procedure_segment ( ) {
91- // Single procedure: name becomes the prefix, joined to the rest with `:`.
91+ // Procedure alone renders as `/name:`
92+ let mut stack = QualifiedPath :: new ( ) ;
93+ stack. push ( PathSegment :: Procedure ( "local_network" ) ) ;
94+ assert_eq ! ( stack. render( ) , "/local_network:" ) ;
95+
96+ // Procedure with a step: `/name:N`.
9297 let mut stack = QualifiedPath :: new ( ) ;
9398 stack. push ( PathSegment :: Procedure ( "make_coffee" ) ) ;
9499 stack. push ( PathSegment :: DependentStep ( "2" ) ) ;
95- assert_eq ! ( stack. render( ) , "make_coffee:2" ) ;
100+ assert_eq ! ( stack. render( ) , "/ make_coffee:2" ) ;
96101
97102 // Nested procedure: the inner frame replaces the outer prefix entirely.
98103 let mut stack = QualifiedPath :: new ( ) ;
99104 stack. push ( PathSegment :: Procedure ( "outer" ) ) ;
100105 stack. push ( PathSegment :: DependentStep ( "1" ) ) ;
101106 stack. push ( PathSegment :: Procedure ( "inner" ) ) ;
102107 stack. push ( PathSegment :: DependentStep ( "2" ) ) ;
103- assert_eq ! ( stack. render( ) , "inner:2" ) ;
108+ assert_eq ! ( stack. render( ) , "/ inner:2" ) ;
104109}
105110
106111#[ test]
107112fn full_qualified_example_from_objective ( ) {
108- // 2/@barista/a/-1 — dependent step 2, role @barista, substep a, first parallel sub-substep
113+ // / 2/@barista/a/-1 — dependent step 2, role @barista, substep a, first parallel sub-substep
109114 let frame = vec ! [ Attribute :: Role ( Identifier :: new( "barista" ) , Span :: default ( ) ) ] ;
110115 let mut stack = QualifiedPath :: new ( ) ;
111116 stack. push ( PathSegment :: DependentStep ( "2" ) ) ;
112117 stack. push ( PathSegment :: Attributes ( & frame) ) ;
113118 stack. push ( PathSegment :: DependentStep ( "a" ) ) ;
114119 stack. push ( PathSegment :: ParallelStep ( 1 ) ) ;
115- assert_eq ! ( stack. render( ) , "2/@barista/a/-1" ) ;
120+ assert_eq ! ( stack. render( ) , "/ 2/@barista/a/-1" ) ;
116121}
0 commit comments