Actually run unstable tests

This commit is contained in:
David Tolnay 2017-03-08 21:02:15 -08:00
parent 0c2fed49e2
commit dd6989d551
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
6 changed files with 19 additions and 63 deletions

View File

@ -5,7 +5,7 @@ authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>"]
publish = false
[features]
unstable-testing = ["compiletest_rs"]
unstable = ["serde/unstable", "compiletest_rs"]
[dev-dependencies]
fnv = "1.0"

View File

@ -1,4 +1,4 @@
#![cfg(feature = "unstable-testing")]
#![cfg(feature = "unstable")]
extern crate compiletest_rs as compiletest;

View File

@ -1,3 +1,5 @@
#![cfg_attr(feature = "unstable", feature(into_boxed_c_str))]
#[macro_use]
extern crate serde_derive;
@ -900,7 +902,7 @@ fn test_cstr() {
#[test]
fn test_net_ipaddr() {
assert_de_tokens(
"1.2.3.4".parse::<net::IpAddr>().unwrap(),
&"1.2.3.4".parse::<net::IpAddr>().unwrap(),
&[Token::Str("1.2.3.4")],
);
}

View File

@ -2,7 +2,7 @@
// successfully when there are a variety of generics and non-(de)serializable
// types involved.
#![cfg_attr(feature = "unstable-testing", feature(non_ascii_idents))]
#![cfg_attr(feature = "unstable", feature(non_ascii_idents))]
#[macro_use]
extern crate serde_derive;
@ -220,8 +220,8 @@ fn test_gen() {
}
assert::<EmptyEnumVariant>();
#[cfg(feature = "unstable-testing")]
#[cfg_attr(feature = "unstable-testing", derive(Serialize, Deserialize))]
#[cfg(feature = "unstable")]
#[derive(Serialize, Deserialize)]
struct NonAsciiIdents {
σ: f64
}
@ -246,12 +246,12 @@ fn test_gen() {
f: u8,
}
#[cfg(feature = "unstable-testing")]
#[cfg_attr(feature = "unstable-testing", derive(Serialize, Deserialize))]
#[cfg(feature = "unstable")]
#[derive(Serialize, Deserialize)]
struct EmptyTuple();
#[cfg(feature = "unstable-testing")]
#[cfg_attr(feature = "unstable-testing", derive(Serialize, Deserialize))]
#[cfg(feature = "unstable")]
#[derive(Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
struct EmptyTupleDenyUnknown();
@ -276,8 +276,8 @@ fn test_gen() {
Variant,
}
#[cfg(feature = "unstable-testing")]
#[cfg_attr(feature = "unstable-testing", derive(Serialize, Deserialize))]
#[cfg(feature = "unstable")]
#[derive(Serialize, Deserialize)]
enum EmptyVariants {
Braced {},
Tuple(),
@ -288,8 +288,8 @@ fn test_gen() {
TupleSkip(#[serde(skip_deserializing)] u8),
}
#[cfg(feature = "unstable-testing")]
#[cfg_attr(feature = "unstable-testing", derive(Serialize, Deserialize))]
#[cfg(feature = "unstable")]
#[derive(Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
enum EmptyVariantsDenyUnknown {
Braced {},

View File

@ -21,9 +21,6 @@ use self::serde_test::{
extern crate fnv;
use self::fnv::FnvHasher;
#[cfg(feature = "unstable")]
use serde::ser::iterator;
#[macro_use]
mod macros;
@ -402,54 +399,11 @@ declare_tests! {
}
}
#[cfg(feature = "unstable")]
#[test]
fn test_iterator() {
assert_ser_tokens(iterator([0; 0].iter()), &[
Token::SeqStart(Some(0)),
Token::SeqEnd,
]);
assert_ser_tokens(iterator([1, 2, 3].iter()), &[
Token::SeqStart(Some(3)),
Token::SeqSep,
Token::I32(1),
Token::SeqSep,
Token::I32(2),
Token::SeqSep,
Token::I32(3),
Token::SeqEnd,
]);
assert_ser_tokens(iterator([1, 2, 3].iter().map(|x| x * 2)), &[
Token::SeqStart(Some(3)),
Token::SeqSep,
Token::I32(2),
Token::SeqSep,
Token::I32(4),
Token::SeqSep,
Token::I32(6),
Token::SeqEnd,
]);
assert_ser_tokens(iterator([1, 2, 3].iter().filter(|&x| x % 2 != 0)), &[
Token::SeqStart(None),
Token::SeqSep,
Token::I32(1),
Token::SeqSep,
Token::I32(3),
Token::SeqEnd,
]);
}
#[cfg(feature = "unstable")]
#[test]
fn test_net_ipaddr() {
assert_ser_tokens(
"1.2.3.4".parse::<net::IpAddr>().unwrap(),
&"1.2.3.4".parse::<net::IpAddr>().unwrap(),
&[Token::Str("1.2.3.4")],
);
}

View File

@ -30,7 +30,7 @@ if [ -n "${CLIPPY}" ]; then
cargo clippy --features unstable-testing -- -Dclippy
cd "$DIR/test_suite"
cargo clippy --features unstable-testing -- -Dclippy
cargo clippy --features unstable -- -Dclippy
cd "$DIR/test_suite/no_std"
cargo clippy -- -Dclippy
@ -46,7 +46,7 @@ else
cd "$DIR/test_suite/deps"
channel build
cd "$DIR/test_suite"
channel test --features unstable-testing
channel test --features unstable
cd "$DIR/test_suite/no_std"
channel build