Skip to content

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.

2 participants