@@ -413,23 +413,6 @@ mod tests {
413413 assert_eq ! ( got[ 1 ] . gcodes( ) . len( ) , 1 ) ;
414414 }
415415
416- /// I wasn't sure if the `#[derive(Serialize)]` would work given we use
417- /// `B::Comments`, which would borrow from the original source.
418- #[ test]
419- #[ cfg( feature = "serde-1" ) ]
420- fn you_can_actually_serialize_lines ( ) {
421- let src = "G01 X5 G90 (comment) G91 M10\n G01\n " ;
422- let line = parse ( src) . next ( ) . unwrap ( ) ;
423-
424- fn assert_serializable < S : serde:: Serialize > ( _: & S ) { }
425- fn assert_deserializable < ' de , D : serde:: Deserialize < ' de > > ( ) { }
426-
427- assert_serializable ( & line) ;
428- assert_deserializable :: < Line < ' _ > > ( ) ;
429- }
430-
431- /// For some reason we were parsing the G90, then an empty G01 and the
432- /// actual G01.
433416 #[ test]
434417 fn funny_bug_in_crate_example ( ) {
435418 let src = "G90 \n G01 X50.0 Y-10" ;
@@ -441,7 +424,24 @@ mod tests {
441424 ] ;
442425
443426 let got: Vec < _ > = crate :: parse ( src) . collect ( ) ;
427+ assert_eq ! ( got, expected) ;
428+ }
429+
430+ #[ test]
431+ fn implicit_command_after_newline ( ) {
432+ let src = "G90 \n G01 X1.0 Y2.0\n X3.0 Y4.0" ;
433+ let expected = vec ! [
434+ GCode :: new( Mnemonic :: General , 90.0 , Span :: PLACEHOLDER ) ,
435+ GCode :: new( Mnemonic :: General , 1.0 , Span :: PLACEHOLDER )
436+ . with_argument( Word :: new( 'X' , 1.0 , Span :: PLACEHOLDER ) )
437+ . with_argument( Word :: new( 'Y' , 2.0 , Span :: PLACEHOLDER ) ) ,
438+ GCode :: new( Mnemonic :: General , 1.0 , Span :: PLACEHOLDER )
439+ . with_argument( Word :: new( 'X' , 3.0 , Span :: PLACEHOLDER ) )
440+ . with_argument( Word :: new( 'Y' , 4.0 , Span :: PLACEHOLDER ) ) ,
441+ ] ;
444442
443+ let got: Vec < _ > = crate :: parse ( src) . collect ( ) ;
445444 assert_eq ! ( got, expected) ;
446445 }
446+
447447}
0 commit comments