Skip to content

Commit

Permalink
Diagnose when test features are missing
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Nov 2, 2018
1 parent ec0af59 commit c3f9856
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 12 deletions.
1 change: 1 addition & 0 deletions tests/features/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"Hello! You want: cargo test --release --all-features"
13 changes: 13 additions & 0 deletions tests/features/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#[cfg(not(all(
feature = "derive",
feature = "full",
feature = "parsing",
feature = "printing",
feature = "visit",
feature = "visit-mut",
feature = "fold",
feature = "clone-impls",
feature = "extra-traits",
feature = "proc-macro",
)))]
mod error;
4 changes: 2 additions & 2 deletions tests/test_asyncness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![cfg(all(feature = "extra-traits", feature = "full"))]

extern crate proc_macro2;
extern crate syn;

mod features;

use proc_macro2::Span;
use syn::punctuated::Punctuated;
use syn::{Block, Expr, ExprBlock, ExprClosure, FnDecl, Ident, ItemFn, ReturnType, Visibility};
Expand Down
4 changes: 2 additions & 2 deletions tests/test_derive_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![cfg(feature = "extra-traits")]

extern crate proc_macro2;
extern crate syn;

mod features;

use proc_macro2::Delimiter::{Brace, Parenthesis};
use proc_macro2::*;
use syn::punctuated::Punctuated;
Expand Down
2 changes: 1 addition & 1 deletion tests/test_generics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![cfg(feature = "extra-traits")]
#![recursion_limit = "1024"]
#![feature(rustc_private)]

Expand All @@ -23,6 +22,7 @@ use proc_macro2::{Ident, Span, TokenStream};
mod macros;

mod common;
mod features;

fn ident(s: &str) -> Ident {
Ident::new(s, Span::call_site())
Expand Down
2 changes: 1 addition & 1 deletion tests/test_grouping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![cfg(all(feature = "extra-traits", feature = "full"))]
#![recursion_limit = "1024"]
#![feature(rustc_private)]

Expand All @@ -22,6 +21,7 @@ use proc_macro2::*;
mod macros;

mod common;
mod features;

fn expr<T: Into<Expr>>(t: T) -> Expr {
t.into()
Expand Down
2 changes: 2 additions & 0 deletions tests/test_ident.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
extern crate proc_macro2;
extern crate syn;

mod features;

use proc_macro2::{Ident, Span, TokenStream};
use std::str::FromStr;
use syn::parse::Error;
Expand Down
2 changes: 2 additions & 0 deletions tests/test_lit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ extern crate proc_macro2;
extern crate quote;
extern crate syn;

mod features;

use proc_macro2::{TokenStream, TokenTree};
use quote::ToTokens;
use std::str::FromStr;
Expand Down
4 changes: 2 additions & 2 deletions tests/test_meta_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![cfg(feature = "extra-traits")]

extern crate proc_macro2;
extern crate quote;
extern crate syn;

mod features;

use proc_macro2::{Ident, Literal, Span};
use syn::parse::Parser;
use syn::*;
Expand Down
2 changes: 2 additions & 0 deletions tests/test_pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
extern crate quote;
extern crate syn;

mod features;

#[test]
fn test_pat_ident() {
match syn::parse2(quote!(self)).unwrap() {
Expand Down
3 changes: 2 additions & 1 deletion tests/test_precedence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![cfg(all(feature = "full", feature = "fold"))]
#![recursion_limit = "1024"]
#![feature(rustc_private)]

Expand All @@ -33,6 +32,8 @@ extern crate syn;
extern crate syntax;
extern crate walkdir;

mod features;

use rayon::iter::{IntoParallelIterator, ParallelIterator};
use regex::Regex;
use syntax::ast;
Expand Down
3 changes: 2 additions & 1 deletion tests/test_round_trip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![cfg(feature = "full")]
#![recursion_limit = "1024"]
#![feature(rustc_private)]

Expand All @@ -18,6 +17,8 @@ extern crate syntax;
extern crate syntax_pos;
extern crate walkdir;

mod features;

use rayon::iter::{IntoParallelIterator, ParallelIterator};
use syntax::ast;
use syntax::parse::{self, PResult, ParseSess};
Expand Down
2 changes: 2 additions & 0 deletions tests/test_should_parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

extern crate syn;

mod features;

macro_rules! should_parse {
($name:ident, { $($in:tt)* }) => {
#[test]
Expand Down
4 changes: 2 additions & 2 deletions tests/test_token_trees.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![cfg(feature = "extra-traits")]

extern crate proc_macro2;
#[macro_use]
extern crate quote;
extern crate syn;

mod features;

use proc_macro2::Delimiter::*;
use proc_macro2::*;
use syn::{AttrStyle, Attribute, Lit};
Expand Down

0 comments on commit c3f9856

Please sign in to comment.