Update serde_urlencoded dependency for bugfix

This commit is contained in:
Magnus Hovland Hoff 2018-09-23 21:39:09 +02:00
parent c1fcc80cf0
commit 828490df3b
3 changed files with 46 additions and 4 deletions

6
Cargo.lock generated
View file

@ -787,7 +787,7 @@ dependencies = [
"serde_derive 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_plain 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_urlencoded 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_urlencoded 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
"slug 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"titlecase 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
@ -854,7 +854,7 @@ dependencies = [
[[package]]
name = "serde_urlencoded"
version = "0.5.2"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1425,7 +1425,7 @@ dependencies = [
"checksum serde_derive 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)" = "0a90213fa7e0f5eac3f7afe2d5ff6b088af515052cc7303bd68c7e3b91a3fb79"
"checksum serde_json 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)" = "fc97cccc2959f39984524026d760c08ef0dd5f0f5948c8d31797dbfae458c875"
"checksum serde_plain 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "625fb0da2b006092b426a94acc1611bec52f2ec27bb27b266a9f93c29ee38eda"
"checksum serde_urlencoded 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e703cef904312097cfceab9ce131ff6bbe09e8c964a0703345a5f49238757bc1"
"checksum serde_urlencoded 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "aaed41d9fb1e2f587201b863356590c90c1157495d811430a0c0325fe8169650"
"checksum sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a"
"checksum slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b4fcaed89ab08ef143da37bc52adbcc04d4a69014f4c1208d6b51f0c47bc23"
"checksum slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fdeff4cd9ecff59ec7e3744cbca73dfe5ac35c2aedb2cfba8a1c715a18912e9d"

View file

@ -38,7 +38,7 @@ seahash = "3.0.5"
serde = "1.0.0"
serde_derive = "1.0.0"
serde_json = "1.0"
serde_urlencoded = "0.5"
serde_urlencoded = "0.5.3"
slug = "0.1"
titlecase = "0.10"
tokio-io = "0.1"

View file

@ -91,7 +91,9 @@ mod test {
use diesel::prelude::*;
use diesel::sql_query;
use diesel::sql_types::Text;
use serde_json;
use serde_plain;
use serde_urlencoded;
use super::*;
@ -105,6 +107,46 @@ mod test {
assert_eq!(serde_plain::to_string(&Theme::LightGreen).unwrap(), "light-green");
}
#[test]
fn serialize_json() {
#[derive(Serialize)]
struct Test { x: Theme }
assert_eq!(
serde_json::to_string(&Test { x: Theme::Red }).unwrap(),
"{\"x\":\"red\"}"
);
}
#[test]
fn deserialize_json() {
#[derive(Deserialize, Debug, PartialEq, Eq)]
struct Test { x: Theme }
assert_eq!(
serde_json::from_str::<Test>("{\"x\":\"red\"}").unwrap(),
Test { x: Theme::Red }
);
}
#[test]
fn serialize_urlencoded() {
#[derive(Serialize)]
struct Test { x: Theme }
assert_eq!(
serde_urlencoded::to_string(&Test { x: Theme::Red }).unwrap(),
"x=red"
);
}
#[test]
fn deserialize_urlencoded() {
#[derive(Deserialize, Debug, PartialEq, Eq)]
struct Test { x: Theme }
assert_eq!(
serde_urlencoded::from_str::<Test>("x=red").unwrap(),
Test { x: Theme::Red }
);
}
#[test]
fn basic_display() {
assert_eq!(&Theme::Red.to_string(), "red");