message: Add tests for doc testing proc macro crates
diff: @@ -178,3 +178,57 @@ fn plugin_and_proc_macro() {
  assert_that(questionable.cargo_process("build"),
  execs().with_status(101).with_stderr_contains(msg));
  }
  +
  +#[test]
  +fn proc_macro_doctest() {
  + if !is_nightly() {
  + return
  + }
  + let foo = project("foo")
  + .file("Cargo.toml", r#"
  + [package]
  + name = "foo"
  + version = "0.1.0"
  + authors = []
  + [lib]
  + proc-macro = true
  + "#)
  + .file("src/lib.rs", r#"
  +#![feature(proc_macro, proc_macro_lib)]
  +#![crate_type = "proc-macro"]
  +
  +extern crate proc_macro;
  +
  +use proc_macro::TokenStream;
  +
  +/// ```
  +/// assert!(true);
  +/// ```
  +#[proc_macro_derive(Bar)]
  +pub fn derive(_input: TokenStream) -> TokenStream {
  + "".parse().unwrap()
  +}
  +
  +#[test]
  +fn a() {
  + assert!(true);
  +}
  +"#);
  + foo.build();
  +
  + assert_that(foo.cargo_process("test"),
  + execs().with_status(0)
  + .with_stdout_contains("\
  +running 1 test
  +test a ... ok
  +
  +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
  +
  +").with_stdout_contains("\
  +running 1 test
  +test derive_0 ... ok
  +
  +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
  +
  +"));
  +}
  