Skip to content

Commit f3186df

Browse files
committed
Update tests
1 parent d36696e commit f3186df

File tree

3 files changed

+39
-8
lines changed

3 files changed

+39
-8
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// compile-flags: --test
12+
13+
#![feature(termination_trait_test)]
14+
#![feature(test)]
15+
16+
extern crate test;
17+
use std::num::ParseIntError;
18+
use test::Bencher;
19+
20+
#[test]
21+
#[should_panic]
22+
fn not_a_num() -> Result<(), ParseIntError> {
23+
//~^ ERROR functions used as tests returning Result<_, _> must not use #[should_panic]
24+
let _: u32 = "abc".parse()?;
25+
Ok(())
26+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error: functions used as tests returning Result<_, _> must not use #[should_panic]
2+
--> $DIR/termination-trait-in-test-should-panic.rs:22:1
3+
|
4+
LL | / fn not_a_num() -> Result<(), ParseIntError> {
5+
LL | | //~^ ERROR functions used as tests returning Result<_, _> must not use #[should_panic]
6+
LL | | let _: u32 = "abc".parse()?;
7+
LL | | Ok(())
8+
LL | | }
9+
| |_^
10+
11+
error: aborting due to previous error
12+

src/test/run-pass/rfc-1937-termination-trait/termination-trait-in-test.rs renamed to src/test/ui/rfc-1937-termination-trait/termination-trait-in-test.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
// compile-flags: --test
12+
// run-pass
1213

1314
#![feature(termination_trait_test)]
1415
#![feature(test)]
@@ -23,14 +24,6 @@ fn is_a_num() -> Result<(), ParseIntError> {
2324
Ok(())
2425
}
2526

26-
#[test]
27-
#[should_panic]
28-
fn not_a_num() -> Result<(), ParseIntError> {
29-
//~^ ERROR test functions returning Result<_, _> must not use #[should_panic]
30-
let _: u32 = "abc".parse()?;
31-
Ok(())
32-
}
33-
3427
#[bench]
3528
fn test_a_positive_bench(_: &mut Bencher) -> Result<(), ParseIntError> {
3629
Ok(())

0 commit comments

Comments
 (0)