mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-12 23:41:03 +00:00
Make a directory dedicated to regression tests
I have had a good experience with this pattern in many of my other libraries.
This commit is contained in:
@@ -12,6 +12,7 @@ unstable = ["serde/unstable"]
|
|||||||
serde = { path = "../serde" }
|
serde = { path = "../serde" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
automod = "1.0"
|
||||||
fnv = "1.0"
|
fnv = "1.0"
|
||||||
rustversion = "1.0"
|
rustversion = "1.0"
|
||||||
serde = { path = "../serde", features = ["rc", "derive"] }
|
serde = { path = "../serde", features = ["rc", "derive"] }
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
mod regression {
|
||||||
|
automod::dir!("tests/regression");
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
use serde::Deserialize;
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
pub struct Nested;
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
pub enum ExternallyTagged {
|
||||||
|
Flatten {
|
||||||
|
#[serde(flatten)]
|
||||||
|
nested: Nested,
|
||||||
|
string: &'static str,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
#[serde(tag = "tag")]
|
||||||
|
pub enum InternallyTagged {
|
||||||
|
Flatten {
|
||||||
|
#[serde(flatten)]
|
||||||
|
nested: Nested,
|
||||||
|
string: &'static str,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
#[serde(tag = "tag", content = "content")]
|
||||||
|
pub enum AdjacentlyTagged {
|
||||||
|
Flatten {
|
||||||
|
#[serde(flatten)]
|
||||||
|
nested: Nested,
|
||||||
|
string: &'static str,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
#[serde(untagged)]
|
||||||
|
pub enum UntaggedWorkaround {
|
||||||
|
Flatten {
|
||||||
|
#[serde(flatten)]
|
||||||
|
nested: Nested,
|
||||||
|
string: &'static str,
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -892,52 +892,3 @@ pub struct RemotePackedNonCopyDef {
|
|||||||
impl Drop for RemotePackedNonCopyDef {
|
impl Drop for RemotePackedNonCopyDef {
|
||||||
fn drop(&mut self) {}
|
fn drop(&mut self) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
/// Regression tests for <https://github.com/serde-rs/serde/issues/2371>
|
|
||||||
pub mod static_and_flatten {
|
|
||||||
use serde::Deserialize;
|
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
|
||||||
pub struct Nested;
|
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
|
||||||
pub enum ExternallyTagged {
|
|
||||||
Flatten {
|
|
||||||
#[serde(flatten)]
|
|
||||||
nested: Nested,
|
|
||||||
string: &'static str,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
|
||||||
#[serde(tag = "tag")]
|
|
||||||
pub enum InternallyTagged {
|
|
||||||
Flatten {
|
|
||||||
#[serde(flatten)]
|
|
||||||
nested: Nested,
|
|
||||||
string: &'static str,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
|
||||||
#[serde(tag = "tag", content = "content")]
|
|
||||||
pub enum AdjacentlyTagged {
|
|
||||||
Flatten {
|
|
||||||
#[serde(flatten)]
|
|
||||||
nested: Nested,
|
|
||||||
string: &'static str,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
|
||||||
#[serde(untagged)]
|
|
||||||
pub enum UntaggedWorkaround {
|
|
||||||
Flatten {
|
|
||||||
#[serde(flatten)]
|
|
||||||
nested: Nested,
|
|
||||||
string: &'static str,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user