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

Add every rustdoc language annotation #83

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ErikBot42
Copy link

This adds support for every language annotation that rustdoc recognizes

should_panic   
should-panic   <- new  
shouldpanic    <- new 
no_run         
no-run         <- new      
norun          <- new
ignore         
ignore-.*      <- new
rust           
test_harness   <- new  
test-harness   <- new  
testharness    <- new 
compile_fail   <- new
compile-fail   <- new
compilefail    <- new
edition....    <- new
E....          <- new    

The only change that was needed was to modify the regex that recognized if a code block is rust code

The new regex works on this input:

test file

//! should_panic:
//! ```should_panic
//! let a = 3;
//! ```
//! should-panic:
//! ```should-panic
//! let a = 3;
//! ```
//! shouldpanic:
//! ```shouldpanic
//! let a = 3;
//! ```
//! no_run:
//! ```no_run
//! let a = 3;
//! ```
//! no-run:
//! ```no-run
//! let a = 3;
//! ```
//! norun:
//! ```norun
//! let a = 3;
//! ```
//! ignore:
//! ```ignore
//! let a = 3;
//! ```
//! ignore-on-some-hardware:
//! ```ignore-on-some-hardware
//! let a = 3;
//! ```
//! rust:
//! ```rust
//! let a = 3;
//! ```
//! test_harness:
//! ```test_harness
//! let a = 3;
//! ```
//! test-harness:
//! ```test-harness
//! let a = 3;
//! ```
//! testharness:
//! ```testharness
//! let a = 3;
//! ```
//! compile_fail:
//! ```compile_fail
//! let a = 3;
//! ```
//! compile-fail:
//! ```compile-fail
//! let a = 3;
//! ```
//! compilefail:
//! ```compilefail
//! let a = 3;
//! ```
//! edition2015
//! ```edition2015
//! let a = 3;
//! ```
//! E1234:
//! ```E1234
//! let a = 3;
//! ```

output

should_panic:

let a = 3;

should-panic:

let a = 3;

shouldpanic:

let a = 3;

no_run:

let a = 3;

no-run:

let a = 3;

norun:

let a = 3;

ignore:

let a = 3;

ignore-on-some-hardware:

let a = 3;

rust:

let a = 3;

test_harness:

let a = 3;

test-harness:

let a = 3;

testharness:

let a = 3;

compile_fail:

let a = 3;

compile-fail:

let a = 3;

compilefail:

let a = 3;

edition2015

let a = 3;

E1234:

let a = 3;

Copy link
Owner

@webern webern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took ownership of this repository primarily to keep dependencies updated and I don't really know the code. However, it looks like all that is required to add tests for your feature addition is to update the variables INPUT_RUST_CODE_BLOCK, INPUT_RUST_CODE_BLOCK_RUST_PREFIX, and EXPECTED_RUST_CODE_BLOCK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants