Skip to content
This repository has been archived by the owner on Apr 11, 2021. It is now read-only.

Add assert_test_result required by latest nightly #2

Merged
merged 1 commit into from
Feb 25, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,20 @@ pub fn test_main_static(tests: &[TestDescAndFn]) {
}
}

pub trait Termination {
fn report(self) -> i32;
}

impl Termination for () {
fn report(self) -> i32 {
0
}
}

pub fn assert_test_result<T: Termination>(result: T) {
assert_eq!(result.report(), 0);
}

// required for compatibility with the `rustc --test` interface
pub struct TestDescAndFn {
pub desc: TestDesc,
Expand Down