Skip to content

Allow fail messages to be caught, introduce Any trait #9967

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 28, 2013
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions src/libextra/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ mod tests {
let m = Mutex::new();
let m2 = m.clone();

let result: result::Result<(),()> = do task::try {
let result: result::Result<(), ~Any> = do task::try {
do m2.lock {
fail!();
}
Expand All @@ -935,7 +935,7 @@ mod tests {
let m = Mutex::new();
let m2 = m.clone();

let result: result::Result<(),()> = do task::try {
let result: result::Result<(), ~Any> = do task::try {
let (p, c) = comm::stream();
do task::spawn || { // linked
let _ = p.recv(); // wait for sibling to get in the mutex
Expand Down Expand Up @@ -963,7 +963,7 @@ mod tests {
let m2 = m.clone();
let (p, c) = comm::stream();

let result: result::Result<(),()> = do task::try {
let result: result::Result<(), ~Any> = do task::try {
let mut sibling_convos = ~[];
do 2.times {
let (p, c) = comm::stream();
Expand Down Expand Up @@ -1272,7 +1272,7 @@ mod tests {
let x = RWLock::new();
let x2 = x.clone();

let result: result::Result<(),()> = do task::try || {
let result: result::Result<(), ~Any> = do task::try || {
do lock_rwlock_in_mode(&x2, mode1) {
fail!();
}
Expand Down
3 changes: 1 addition & 2 deletions src/libextra/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -873,8 +873,7 @@ pub fn run_test(force_ignore: bool,
task.spawn(testfn_cell.take());

let task_result = result_future.recv();
let test_result = calc_result(&desc,
task_result == task::Success);
let test_result = calc_result(&desc, task_result.is_ok());
monitor_ch.send((desc.clone(), test_result));
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/librustpkg/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -640,9 +640,8 @@ fn test_install_invalid() {
pkgid.clone());
ctxt.install(pkg_src, &WhatToBuild::new(MaybeCustom, Everything));
};
// Not the best test -- doesn't test that we failed in the right way.
// Best we can do for now.
assert!(result == Err(()));
assert!(result.unwrap_err()
.to_str().contains("supplied path for package dir does not exist"));
}

#[test]
Expand Down
Loading