@@ -436,7 +436,7 @@ second_node /* This time, the comment is here */ param=153 {
436436 /- comment
437437 /* block comment */
438438 inline /*comment*/ here
439- another /-commend there
439+ another /-comment there
440440
441441
442442 after some whitespace
@@ -485,7 +485,7 @@ final;";
485485 ) ;
486486
487487 let foo = doc. get ( "foo" ) . expect ( "expected a foo node" ) ;
488- assert_eq ! ( foo. format( ) . map( |f| & f. trailing [ ..] ) , Some ( "\n " ) ) ;
488+ assert_eq ! ( foo. format( ) . map( |f| & f. terminator [ ..] ) , Some ( "\n " ) ) ;
489489 assert_eq ! ( & foo[ 2 ] , & "three" . into( ) ) ;
490490 assert_eq ! ( & foo[ "bar" ] , & "baz" . into( ) ) ;
491491 assert_eq ! (
@@ -527,6 +527,7 @@ final;";
527527 // if you're making KdlEntries this way, you need to inject
528528 // your own whitespace (or format the node)
529529 node. push ( " \" blah\" =0xDEADbeef" . parse :: < KdlEntry > ( ) ?) ;
530+ dbg ! ( & node) ;
530531 doc. nodes_mut ( ) . push ( node) ;
531532
532533 assert_eq ! (
@@ -714,7 +715,8 @@ this {
714715}
715716// that's
716717nice
717- inline { time; to; live "our" "dreams"; "y;all"; }
718+ inline { time; to; live "our" "dreams"; "y;all" }
719+
718720"#### ;
719721
720722 let doc: KdlDocument = input. parse ( ) ?;
@@ -724,8 +726,9 @@ inline { time; to; live "our" "dreams"; "y;all"; }
724726
725727 // Now check some more interesting concrete spans
726728
727- // The whole document should presumably be "the input" again?
728- check_span ( input, doc. span ( ) , & input) ;
729+ // The whole document should be everything from the first node until the
730+ // last before_terminator whitespace.
731+ check_span ( & input[ 1 ..( input. len ( ) - 2 ) ] , doc. span ( ) , & input) ;
729732
730733 // This one-liner node should be the whole line without leading whitespace
731734 let is_node = doc
@@ -772,13 +775,11 @@ inline { time; to; live "our" "dreams"; "y;all"; }
772775 ) ;
773776
774777 // The child document is a little weird, it's the contents *inside* the braces
775- // with extra newlines on both ends .
778+ // without the surrounding whitespace/comments. Just the actual contents .
776779 check_span (
777- r####"{
778- "it" /*shh*/ "has"="💯" ##"the"##
780+ r####""it" /*shh*/ "has"="💯" ##"the"##
779781 Best🎊est
780- "syntax ever"
781- }"#### ,
782+ "syntax ever""#### ,
782783 and_node. children ( ) . unwrap ( ) . span ( ) ,
783784 & input,
784785 ) ;
@@ -807,14 +808,14 @@ inline { time; to; live "our" "dreams"; "y;all"; }
807808 // Make sure inline nodes work ok
808809 let inline_node = doc. get ( "inline" ) . unwrap ( ) ;
809810 check_span (
810- r#"inline { time; to; live "our" "dreams"; "y;all"; }"# ,
811+ r#"inline { time; to; live "our" "dreams"; "y;all" }"# ,
811812 inline_node. span ( ) ,
812813 & input,
813814 ) ;
814815
815816 let inline_children = inline_node. children ( ) . unwrap ( ) ;
816817 check_span (
817- r#"{ time; to; live "our" "dreams"; "y;all"; } "# ,
818+ r#"time; to; live "our" "dreams"; "y;all" "# ,
818819 inline_children. span ( ) ,
819820 & input,
820821 ) ;
0 commit comments