[librsvg: 2/7] parsers.rs: Add tests for garbage in number lists
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 2/7] parsers.rs: Add tests for garbage in number lists
- Date: Thu, 22 Jun 2017 18:25:35 +0000 (UTC)
commit 35cca0035a6c75b258e2f4cdc0968d68557d8d50
Author: Federico Mena Quintero <federico gnome org>
Date: Mon Jun 19 20:29:08 2017 -0500
parsers.rs: Add tests for garbage in number lists
rust/src/parsers.rs | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/rust/src/parsers.rs b/rust/src/parsers.rs
index b92afeb..948f5c5 100644
--- a/rust/src/parsers.rs
+++ b/rust/src/parsers.rs
@@ -420,6 +420,12 @@ mod tests {
// empty
assert! (number_list ("", ListLength::Exact (1)).is_err ());
+ // garbage
+ assert! (number_list ("foo", ListLength::Exact (1)).is_err ());
+ assert! (number_list ("1foo", ListLength::Exact (2)).is_err ());
+ assert! (number_list ("1 foo", ListLength::Exact (2)).is_err ());
+ assert! (number_list ("1,foo", ListLength::Exact (2)).is_err ());
+
// too many
assert! (number_list ("1 2", ListLength::Exact (1)).is_err ());
assert! (number_list ("1,2,3", ListLength::Maximum (2)).is_err ());
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]