mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-06-17 16:16:37 +00:00
Add serialisation test for Strategy
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
832a6c13ae
commit
ac19952110
3 changed files with 21 additions and 0 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -425,6 +425,7 @@ dependencies = [
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"semver",
|
"semver",
|
||||||
"serde",
|
"serde",
|
||||||
|
"serde_json",
|
||||||
"strum",
|
"strum",
|
||||||
"strum_macros",
|
"strum_macros",
|
||||||
"url",
|
"url",
|
||||||
|
|
|
@ -18,3 +18,6 @@ serde = { version = "1.0.163", features = ["derive"] }
|
||||||
strum = "0.26.1"
|
strum = "0.26.1"
|
||||||
strum_macros = "0.26.1"
|
strum_macros = "0.26.1"
|
||||||
url = { version = "2.3.1", features = ["serde"] }
|
url = { version = "2.3.1", features = ["serde"] }
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
serde_json = "1"
|
||||||
|
|
|
@ -177,3 +177,20 @@ pub enum SigningAlgorithm {
|
||||||
/// [minisign](https://jedisct1.github.io/minisign/)
|
/// [minisign](https://jedisct1.github.io/minisign/)
|
||||||
Minisign,
|
Minisign,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use strum::VariantArray;
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_strategy_ser() {
|
||||||
|
Strategy::VARIANTS.iter().for_each(|strategy| {
|
||||||
|
assert_eq!(
|
||||||
|
serde_json::to_string(&strategy).unwrap(),
|
||||||
|
format!(r#""{}""#, strategy.to_str())
|
||||||
|
)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue