[librsvg: 16/28] path_parser: Test the number of arguments to lineto



commit 6852fc1bd694b6fb52217a388cb5650e49ba32a6
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Jan 23 10:29:41 2018 -0600

    path_parser: Test the number of arguments to lineto

 rust/src/path_parser.rs | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
---
diff --git a/rust/src/path_parser.rs b/rust/src/path_parser.rs
index 07eca05..1236510 100644
--- a/rust/src/path_parser.rs
+++ b/rust/src/path_parser.rs
@@ -1616,4 +1616,18 @@ mod tests {
                           closepath()],
                     Some(ErrorKind::UnexpectedToken));
     }
+
+    #[test]
+    fn lineto_args() {
+        test_parser("M10-20L10",
+                    "         ^",
+                    &vec![moveto(10.0, -20.0)],
+                    Some(ErrorKind::UnexpectedEof));
+
+        test_parser("M 10,10 L 20,20,30",
+                    "                  ^",
+                    &vec![moveto(10.0, 10.0),
+                          lineto(20.0, 20.0)],
+                    Some(ErrorKind::UnexpectedEof));
+    }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]