summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Endler <matthias.endler@trivago.com>2016-09-15 00:24:52 +0200
committerMatthias Endler <matthias.endler@trivago.com>2016-09-18 19:15:03 +0200
commitf639279e3ea7c87ed418bb46e0f65f2017f6c19f (patch)
tree57a06b51afe37a5d86794c7725c9f43aed294b12 /tests
parent042a5eb0779dc38d3db3166ba997d4662ed6f5e7 (diff)
Add support for option parameters
Diffstat (limited to 'tests')
-rw-r--r--tests/test_serialize.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/test_serialize.rs b/tests/test_serialize.rs
new file mode 100644
index 0000000..20592fc
--- /dev/null
+++ b/tests/test_serialize.rs
@@ -0,0 +1,27 @@
+extern crate serde_urlencoded;
+
+#[test]
+fn serialize_option_map_int() {
+ let params = &[
+ ("first", Some(23)),
+ ("middle", None),
+ ("last", Some(42)),
+ ];
+
+ assert_eq!(
+ serde_urlencoded::to_string(params),
+ Ok("first=23&last=42".to_owned()));
+}
+
+#[test]
+fn serialize_option_map_string() {
+ let params = &[
+ ("first", Some("hello")),
+ ("middle", None),
+ ("last", Some("world")),
+ ];
+
+ assert_eq!(
+ serde_urlencoded::to_string(params),
+ Ok("first=hello&last=world".to_owned()));
+}