diff options
Diffstat (limited to 'src/libcore/task')
| -rw-r--r-- | src/libcore/task/local_data.rs | 10 | ||||
| -rw-r--r-- | src/libcore/task/mod.rs | 40 | ||||
| -rw-r--r-- | src/libcore/task/spawn.rs | 4 |
3 files changed, 27 insertions, 27 deletions
diff --git a/src/libcore/task/local_data.rs b/src/libcore/task/local_data.rs index 42765ef139f..5136af810e8 100644 --- a/src/libcore/task/local_data.rs +++ b/src/libcore/task/local_data.rs @@ -133,15 +133,15 @@ fn test_tls_modify() { fn my_key(_x: @~str) { } local_data_modify(my_key, |data| { match data { - Some(@ref val) => fail ~"unwelcome value: " + *val, + Some(@ref val) => die!(~"unwelcome value: " + *val), None => Some(@~"first data") } }); local_data_modify(my_key, |data| { match data { Some(@~"first data") => Some(@~"next data"), - Some(@ref val) => fail ~"wrong value: " + *val, - None => fail ~"missing value" + Some(@ref val) => die!(~"wrong value: " + *val), + None => die!(~"missing value") } }); assert *(local_data_pop(my_key).get()) == ~"next data"; @@ -212,11 +212,11 @@ fn test_tls_cleanup_on_failure() { local_data_set(str_key, @~"string data"); local_data_set(box_key, @@()); local_data_set(int_key, @42); - fail; + die!(); } } // Not quite nondeterministic. local_data_set(int_key, @31337); - fail; + die!(); } } diff --git a/src/libcore/task/mod.rs b/src/libcore/task/mod.rs index 62d317abb95..a34956c87ba 100644 --- a/src/libcore/task/mod.rs +++ b/src/libcore/task/mod.rs @@ -218,7 +218,7 @@ pub fn task() -> TaskBuilder { priv impl TaskBuilder { fn consume() -> TaskBuilder { if self.consumed { - fail ~"Cannot copy a task_builder"; // Fake move mode on self + die!(~"Cannot copy a task_builder"); // Fake move mode on self } self.consumed = true; let notify_chan = replace(&mut self.opts.notify_chan, None); @@ -314,7 +314,7 @@ impl TaskBuilder { // sending out messages. if self.opts.notify_chan.is_some() { - fail ~"Can't set multiple future_results for one task!"; + die!(~"Can't set multiple future_results for one task!"); } // Construct the future and give it to the caller. @@ -548,7 +548,7 @@ pub fn yield() { let task_ = rt::rust_get_task(); let killed = rt::rust_task_yield(task_); if killed && !failing() { - fail ~"killed"; + die!(~"killed"); } } } @@ -694,24 +694,24 @@ fn test_spawn_unlinked_unsup_no_fail_down() { // grandchild sends on a port for iter::repeat(16) { task::yield(); } ch.send(()); // If killed first, grandparent hangs. } - fail; // Shouldn't kill either (grand)parent or (grand)child. + die!(); // Shouldn't kill either (grand)parent or (grand)child. } po.recv(); } #[test] #[ignore(cfg(windows))] fn test_spawn_unlinked_unsup_no_fail_up() { // child unlinked fails - do spawn_unlinked { fail; } + do spawn_unlinked { die!(); } } #[test] #[ignore(cfg(windows))] fn test_spawn_unlinked_sup_no_fail_up() { // child unlinked fails - do spawn_supervised { fail; } + do spawn_supervised { die!(); } // Give child a chance to fail-but-not-kill-us. for iter::repeat(16) { task::yield(); } } #[test] #[should_fail] #[ignore(cfg(windows))] fn test_spawn_unlinked_sup_fail_down() { do spawn_supervised { loop { task::yield(); } } - fail; // Shouldn't leave a child hanging around. + die!(); // Shouldn't leave a child hanging around. } #[test] #[should_fail] #[ignore(cfg(windows))] @@ -754,7 +754,7 @@ fn test_spawn_linked_sup_fail_down() { // parent fails; child fails .. b0 }; do b1.spawn { loop { task::yield(); } } - fail; // *both* mechanisms would be wrong if this didn't kill the child... + die!(); // *both* mechanisms would be wrong if this didn't kill the child } #[test] #[should_fail] #[ignore(cfg(windows))] fn test_spawn_linked_unsup_fail_up() { // child fails; parent fails @@ -767,13 +767,13 @@ fn test_spawn_linked_unsup_fail_up() { // child fails; parent fails fn test_spawn_linked_unsup_fail_down() { // parent fails; child fails // Default options are to spawn linked & unsupervised. do spawn { loop { task::yield(); } } - fail; + die!(); } #[test] #[should_fail] #[ignore(cfg(windows))] fn test_spawn_linked_unsup_default_opts() { // parent fails; child fails // Make sure the above test is the same as this one. do task().linked().spawn { loop { task::yield(); } } - fail; + die!(); } // A couple bonus linked failure tests - testing for failure propagation even @@ -788,7 +788,7 @@ fn test_spawn_failure_propagate_grandchild() { } } for iter::repeat(16) { task::yield(); } - fail; + die!(); } #[test] #[should_fail] #[ignore(cfg(windows))] @@ -800,7 +800,7 @@ fn test_spawn_failure_propagate_secondborn() { } } for iter::repeat(16) { task::yield(); } - fail; + die!(); } #[test] #[should_fail] #[ignore(cfg(windows))] @@ -812,7 +812,7 @@ fn test_spawn_failure_propagate_nephew_or_niece() { } } for iter::repeat(16) { task::yield(); } - fail; + die!(); } #[test] #[should_fail] #[ignore(cfg(windows))] @@ -824,7 +824,7 @@ fn test_spawn_linked_sup_propagate_sibling() { } } for iter::repeat(16) { task::yield(); } - fail; + die!(); } #[test] @@ -868,7 +868,7 @@ fn test_future_result() { result = None; do task().future_result(|+r| { result = Some(move r); }).unlinked().spawn { - fail; + die!(); } assert option::unwrap(move result).recv() == Failure; } @@ -884,7 +884,7 @@ fn test_try_success() { ~"Success!" } { result::Ok(~"Success!") => (), - _ => fail + _ => die!() } } @@ -892,10 +892,10 @@ fn test_try_success() { #[ignore(cfg(windows))] fn test_try_fail() { match do try { - fail + die!() } { result::Err(()) => (), - result::Ok(()) => fail + result::Ok(()) => die!() } } @@ -1095,7 +1095,7 @@ fn test_unkillable() { yield(); // We want to fail after the unkillable task // blocks on recv - fail; + die!(); } unsafe { @@ -1130,7 +1130,7 @@ fn test_unkillable_nested() { yield(); // We want to fail after the unkillable task // blocks on recv - fail; + die!(); } unsafe { diff --git a/src/libcore/task/spawn.rs b/src/libcore/task/spawn.rs index 3db6fa00f16..e5fa0db63a1 100644 --- a/src/libcore/task/spawn.rs +++ b/src/libcore/task/spawn.rs @@ -697,7 +697,7 @@ fn test_spawn_raw_unsupervise() { .. default_task_opts() }; do spawn_raw(move opts) { - fail; + die!(); } } @@ -727,7 +727,7 @@ fn test_spawn_raw_notify_failure() { .. default_task_opts() }; do spawn_raw(move opts) { - fail; + die!(); } assert notify_po.recv() == Failure; } |
