added tests4

tasks requires user to ignore a testcase
This commit is contained in:
DnOnith 2026-03-03 22:32:24 +01:00
parent 064f057b10
commit 0d69c6b296
3 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,11 @@
fn main() {}
#[cfg(test)]
mod tests {
//TODO make sure this test does not run
#[test]
fn ignore_test() {
// Do not change this line
panic!("The test wasn't ignored");
}
}

View File

@ -868,6 +868,17 @@ To handle that, you need to add a special attribute to the test function.
You can refer to the docs:
https://doc.rust-lang.org/book/ch11-01-writing-tests.html#checking-for-panics-with-should_panic"""
[[exercises]]
name = "tests4"
dir = "17_tests"
hint = """
The test always panics, so we need a way to simply ignore it.
For this, similarly to the exercise tests3, we can add a special attribute to the test function.
You can refer to the docs:
https://doc.rust-lang.org/book/ch11-02-running-tests.html#ignoring-tests-unless-specifically-requested
"""
# STANDARD LIBRARY TYPES
[[exercises]]

View File

@ -0,0 +1,11 @@
fn main() {}
#[cfg(test)]
mod tests {
#[test]
#[ignore] //this line simply ignores the test
fn ignore_test() {
panic!("The test wasn't ignored");
}
}