Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eRFC: Custom test frameworks #2318

Merged
merged 22 commits into from
Apr 28, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add context
Manishearth committed Feb 4, 2018
commit 2ad377877699ae85cf944bb5d93d677ca92df22d
9 changes: 7 additions & 2 deletions text/0000-erfc-post-build-contexts.md
Original file line number Diff line number Diff line change
@@ -77,18 +77,23 @@ called `mytest`:

```rust
extern crate proc_macro;
use proc_macro::TokenStream;
use proc_macro::{TestFrameworkContext, TokenStream};

// attributes() is optional
#[test_framework(attributes(foo, bar))]
pub fn mytest(items: &[AnnotatedItem]) -> TokenStream {
pub fn mytest(context: &TestFrameworkContext) -> TokenStream {
// ...
}
```

where

```rust
struct TestFrameworkContext<'a> {
items: &'a [AnnotatedItem],
// ... (may be added in the future)
}

struct AnnotatedItem
tokens: TokenStream,
span: Span,