Skip to content

Commit

Permalink
Add test.
Browse files Browse the repository at this point in the history
  • Loading branch information
jseyfried committed Apr 3, 2017
1 parent df1405d commit 3b6b779
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
@@ -0,0 +1,23 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// no-prefer-dynamic

#![crate_type = "proc-macro"]

extern crate proc_macro;

use proc_macro::TokenStream;

#[proc_macro_derive(Example)]
pub fn example(input: TokenStream) -> TokenStream {
assert!(input.to_string().contains("i32"));
"".parse().unwrap()
}
26 changes: 26 additions & 0 deletions src/test/run-pass-fulldeps/proc-macro/type_macros.rs
@@ -0,0 +1,26 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// aux-build:type_macros_example.rs

#![feature(proc_macro)]

extern crate type_macros_example;

use type_macros_example::Example;

macro_rules! m { () => { i32 } }

#[derive(Example)]
struct S {
x: m!(),
}

fn main() {}

0 comments on commit 3b6b779

Please sign in to comment.