@@ -130,6 +130,7 @@ where
130
130
word. span ,
131
131
B :: Arguments :: default ( ) ,
132
132
) ) ;
133
+
133
134
return ;
134
135
}
135
136
@@ -413,23 +414,6 @@ mod tests {
413
414
assert_eq ! ( got[ 1 ] . gcodes( ) . len( ) , 1 ) ;
414
415
}
415
416
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.
433
417
#[ test]
434
418
fn funny_bug_in_crate_example ( ) {
435
419
let src = "G90 \n G01 X50.0 Y-10" ;
@@ -441,7 +425,43 @@ mod tests {
441
425
] ;
442
426
443
427
let got: Vec < _ > = crate :: parse ( src) . collect ( ) ;
428
+ assert_eq ! ( got, expected) ;
429
+ }
430
+
431
+ #[ test]
432
+ #[ ignore]
433
+ fn implicit_command_after_newline ( ) {
434
+ let src = "G01 X1.0 Y2.0\n X3.0 Y4.0" ;
435
+ let expected = vec ! [
436
+ GCode :: new( Mnemonic :: General , 1.0 , Span :: PLACEHOLDER )
437
+ . with_argument( Word :: new( 'X' , 1.0 , Span :: PLACEHOLDER ) )
438
+ . with_argument( Word :: new( 'Y' , 2.0 , Span :: PLACEHOLDER ) ) ,
439
+ GCode :: new( Mnemonic :: General , 1.0 , Span :: PLACEHOLDER )
440
+ . with_argument( Word :: new( 'X' , 3.0 , Span :: PLACEHOLDER ) )
441
+ . with_argument( Word :: new( 'Y' , 4.0 , Span :: PLACEHOLDER ) ) ,
442
+ ] ;
444
443
444
+ let got: Vec < _ > = crate :: parse ( src) . collect ( ) ;
445
+ assert_eq ! ( got, expected) ;
446
+ }
447
+
448
+ #[ test]
449
+ #[ ignore]
450
+ // This test focuses on the G90 and M7 on the same line.
451
+ fn two_commands_in_a_row ( ) {
452
+ let src = "G90 M7\n G01 X1.0 Y2.0\n X3.0 Y4.0" ;
453
+ let expected = vec ! [
454
+ GCode :: new( Mnemonic :: General , 90.0 , Span :: PLACEHOLDER ) ,
455
+ GCode :: new( Mnemonic :: Miscellaneous , 7.0 , Span :: PLACEHOLDER ) ,
456
+ GCode :: new( Mnemonic :: General , 1.0 , Span :: PLACEHOLDER )
457
+ . with_argument( Word :: new( 'X' , 1.0 , Span :: PLACEHOLDER ) )
458
+ . with_argument( Word :: new( 'Y' , 2.0 , Span :: PLACEHOLDER ) ) ,
459
+ GCode :: new( Mnemonic :: General , 1.0 , Span :: PLACEHOLDER )
460
+ . with_argument( Word :: new( 'X' , 3.0 , Span :: PLACEHOLDER ) )
461
+ . with_argument( Word :: new( 'Y' , 4.0 , Span :: PLACEHOLDER ) ) ,
462
+ ] ;
463
+
464
+ let got: Vec < _ > = crate :: parse ( src) . collect ( ) ;
445
465
assert_eq ! ( got, expected) ;
446
466
}
447
467
}
0 commit comments