[librsvg: 18/28] path_parser: Test for trailing commas with missing arguments



commit 124b9f299bd64421d1abcfe8db628e9547a82941
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Jan 23 10:35:02 2018 -0600

    path_parser: Test for trailing commas with missing arguments

 rust/src/path_parser.rs | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
---
diff --git a/rust/src/path_parser.rs b/rust/src/path_parser.rs
index 00a99bf..7b3c4e3 100644
--- a/rust/src/path_parser.rs
+++ b/rust/src/path_parser.rs
@@ -1584,15 +1584,35 @@ mod tests {
 
     #[test]
     fn moveto_args() {
+        test_parser("M",
+                    " ^",
+                    &vec![],
+                    Some(ErrorKind::UnexpectedEof));
+
+        test_parser("M,",
+                    " ^",
+                    &vec![],
+                    Some(ErrorKind::UnexpectedToken));
+
         test_parser("M10",
                     "   ^",
                     &vec![],
                     Some(ErrorKind::UnexpectedEof));
 
+        test_parser("M10,",
+                    "    ^",
+                    &vec![],
+                    Some(ErrorKind::UnexpectedEof));
+
         test_parser("M10x",
                     "   ^",
                     &vec![],
                     Some(ErrorKind::UnexpectedToken));
+
+        test_parser("M10,x",
+                    "    ^",
+                    &vec![],
+                    Some(ErrorKind::UnexpectedToken));
     }
 
     #[test]
@@ -1615,6 +1635,12 @@ mod tests {
                     &vec![moveto(10.0, -20.0),
                           closepath()],
                     Some(ErrorKind::UnexpectedToken));
+
+        test_parser("M10-20z,",
+                    "       ^",
+                    &vec![moveto(10.0, -20.0),
+                          closepath()],
+                    Some(ErrorKind::UnexpectedToken));
     }
 
     #[test]


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