rust/tests/ui/rfc-1937-termination-trait/termination-trait-in-test.rs
2023-01-11 09:32:08 +00:00

29 lines
476 B
Rust

// compile-flags: --test
// run-pass
// needs-unwind
#![feature(test)]
extern crate test;
use std::num::ParseIntError;
use test::Bencher;
#[test]
fn is_a_num() -> Result<(), ParseIntError> {
let _: u32 = "22".parse()?;
Ok(())
}
#[bench]
fn test_a_positive_bench(_: &mut Bencher) -> Result<(), ParseIntError> {
Ok(())
}
#[bench]
#[should_panic]
fn test_a_neg_bench(_: &mut Bencher) -> Result<(), ParseIntError> {
let _: u32 = "abc".parse()?;
Ok(())
}