[librsvg: 20/28] path_parser: Test for trailing commas after moveto and lineto
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 20/28] path_parser: Test for trailing commas after moveto and lineto
- Date: Tue, 23 Jan 2018 18:00:54 +0000 (UTC)
commit 25bb12542a1fd3853e0421a4debb306dacec489c
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Jan 23 10:39:41 2018 -0600
path_parser: Test for trailing commas after moveto and lineto
rust/src/path_parser.rs | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
---
diff --git a/rust/src/path_parser.rs b/rust/src/path_parser.rs
index fc6ab1c..b80c92b 100644
--- a/rust/src/path_parser.rs
+++ b/rust/src/path_parser.rs
@@ -1617,6 +1617,11 @@ mod tests {
#[test]
fn moveto_implicit_lineto_args() {
+ test_parser("M10-20,",
+ " ^",
+ &vec![moveto(10.0, -20.0)],
+ Some(ErrorKind::UnexpectedEof));
+
test_parser("M10-20-30",
" ^",
&vec![moveto(10.0, -20.0)],
@@ -1655,6 +1660,12 @@ mod tests {
&vec![moveto(10.0, 10.0),
lineto(20.0, 20.0)],
Some(ErrorKind::UnexpectedEof));
+
+ test_parser("M 10,10 L 20,20,",
+ " ^",
+ &vec![moveto(10.0, 10.0),
+ lineto(20.0, 20.0)],
+ Some(ErrorKind::UnexpectedEof));
}
#[test]
@@ -1669,6 +1680,13 @@ mod tests {
&vec![moveto(10.0, -20.0)],
Some(ErrorKind::UnexpectedToken));
+ test_parser("M10-20H30,",
+ " ^",
+ &vec![moveto(10.0, -20.0),
+ lineto(30.0, -20.0)],
+ Some(ErrorKind::UnexpectedEof));
+ }
+
#[test]
fn vertical_lineto_args() {
test_parser("M10-20v",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]