Test never_type
This commit is contained in:
parent
fd6178cad6
commit
22b1af7eb3
@ -7,6 +7,7 @@
|
|||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![cfg_attr(feature = "cargo-clippy", allow(decimal_literal_representation))]
|
#![cfg_attr(feature = "cargo-clippy", allow(decimal_literal_representation))]
|
||||||
|
#![cfg_attr(feature = "unstable", feature(never_type))]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate serde_derive;
|
extern crate serde_derive;
|
||||||
@ -984,6 +985,16 @@ declare_tests! {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "unstable")]
|
||||||
|
declare_tests! {
|
||||||
|
test_never_result {
|
||||||
|
Ok::<u8, !>(0) => &[
|
||||||
|
Token::NewtypeVariant { name: "Result", variant: "Ok" },
|
||||||
|
Token::U8(0),
|
||||||
|
],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
#[test]
|
#[test]
|
||||||
fn test_osstring() {
|
fn test_osstring() {
|
||||||
@ -1051,6 +1062,20 @@ fn test_cstr_internal_null_end() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "unstable")]
|
||||||
|
#[test]
|
||||||
|
fn test_never_type() {
|
||||||
|
assert_de_tokens_error::<!>(&[], "cannot deserialize `!`");
|
||||||
|
|
||||||
|
assert_de_tokens_error::<Result<u8, !>>(
|
||||||
|
&[Token::NewtypeVariant {
|
||||||
|
name: "Result",
|
||||||
|
variant: "Err",
|
||||||
|
}],
|
||||||
|
"cannot deserialize `!`",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
declare_error_tests! {
|
declare_error_tests! {
|
||||||
test_unknown_field<StructDenyUnknown> {
|
test_unknown_field<StructDenyUnknown> {
|
||||||
&[
|
&[
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
#![cfg_attr(feature = "unstable", feature(never_type))]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate serde_derive;
|
extern crate serde_derive;
|
||||||
|
|
||||||
@ -548,6 +550,16 @@ declare_tests! {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "unstable")]
|
||||||
|
declare_tests! {
|
||||||
|
test_never_result {
|
||||||
|
Ok::<u8, !>(0) => &[
|
||||||
|
Token::NewtypeVariant { name: "Result", variant: "Ok" },
|
||||||
|
Token::U8(0),
|
||||||
|
],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
fn test_cannot_serialize_paths() {
|
fn test_cannot_serialize_paths() {
|
||||||
|
Loading…
Reference in New Issue
Block a user