File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
credential/cargo-credential/src Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -186,7 +186,19 @@ mod tests {
186
186
use super :: Error ;
187
187
188
188
#[ test]
189
- pub fn unknown_kind ( ) {
189
+ fn not_supported_roundtrip ( ) {
190
+ let input = Error :: UrlNotSupported ;
191
+
192
+ let expected_json = r#"{"kind":"url-not-supported"}"# ;
193
+ let actual_json = serde_json:: to_string ( & input) . unwrap ( ) ;
194
+ assert_eq ! ( actual_json, expected_json) ;
195
+
196
+ let actual = serde_json:: from_str ( & actual_json) . unwrap ( ) ;
197
+ assert ! ( matches!( actual, Error :: UrlNotSupported ) ) ;
198
+ }
199
+
200
+ #[ test]
201
+ fn deserialize_to_unknown_kind ( ) {
190
202
let json = r#"{
191
203
"kind": "unexpected-kind",
192
204
"unexpected-content": "test"
@@ -196,7 +208,7 @@ mod tests {
196
208
}
197
209
198
210
#[ test]
199
- pub fn roundtrip ( ) {
211
+ fn other_roundtrip ( ) {
200
212
// Construct an error with context
201
213
let e = anyhow:: anyhow!( "E1" ) . context ( "E2" ) . context ( "E3" ) ;
202
214
// Convert to a string with contexts.
You can’t perform that action at this time.
0 commit comments