Skip to content

Commit

Permalink
move test to the proper directory and test #[bench]
Browse files Browse the repository at this point in the history
  • Loading branch information
nikomatsakis committed Feb 23, 2018
1 parent a0562ec commit 0a5f4ae
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
// compile-flags: --test

#![feature(termination_trait)]
#![feature(test)]

extern crate test;
use std::num::ParseIntError;
use test::Bencher;

#[test]
fn is_a_num() -> Result<(), ParseIntError> {
Expand All @@ -26,3 +29,15 @@ fn not_a_num() -> Result<(), ParseIntError> {
let _: u32 = "abc".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(())
}

0 comments on commit 0a5f4ae

Please sign in to comment.