Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
9b09c4f
Add new tests for JoinSet::spawn_local/JoinSet::spawn_local_on and Lo…
FrancescoV1985 Sep 11, 2025
2a07d7f
ignore new test in rt_local for wasm target family
FrancescoV1985 Sep 11, 2025
2a8deed
updated rt_local.rs and task_join_set.rs according to review's comments
FrancescoV1985 Sep 25, 2025
ebe940e
add tests for JoinMap in task_join_map.rs
FrancescoV1985 Sep 26, 2025
12f4713
add missing configuration attribute in task_join_map.rs
FrancescoV1985 Sep 26, 2025
13c211a
add tests for TaskTracker in task_tracker.rs
FrancescoV1985 Sep 26, 2025
c69a37a
add tests for TaskTracker in task_tracker.rs
FrancescoV1985 Sep 26, 2025
22511fe
refactored new JoinSet tests to eliminate duplicated code
FrancescoV1985 Oct 6, 2025
7556da8
Merge branch 'tokio-rs:master' into issue-7562-fix
FrancescoV1985 Oct 7, 2025
de05b54
refactored new JoinMap tests to eliminate duplicated code
FrancescoV1985 Oct 7, 2025
288abdc
improved formatting for new JoinMap tests
FrancescoV1985 Oct 7, 2025
d9feec0
improved formatting (2) for new JoinMap tests
FrancescoV1985 Oct 7, 2025
cd21d97
regrouped new tests for JoinSet and JoinMap thorugh 'mod'
FrancescoV1985 Oct 8, 2025
c7cf4e1
fixed warning during compilation
FrancescoV1985 Oct 8, 2025
86405b6
Apply suggestions from code review
FrancescoV1985 Oct 9, 2025
3fdb1c1
commit suggested changes for task_join_map.rs
FrancescoV1985 Oct 9, 2025
a78c9d2
changed code according to review's feedback
FrancescoV1985 Oct 15, 2025
3f149f7
Merge branch 'tokio-rs:master' into issue-7562-fix
FrancescoV1985 Oct 15, 2025
b86d8d9
Merge branch 'master' into issue-7562-fix
FrancescoV1985 Oct 16, 2025
21eb095
fix missing delimiter
FrancescoV1985 Oct 16, 2025
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
22 changes: 22 additions & 0 deletions tokio/tests/rt_local.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", tokio_unstable))]

use std::panic;
use tokio::runtime::LocalOptions;
use tokio::task::spawn_local;
use tokio::task::LocalSet;

#[test]
fn test_spawn_local_in_runtime() {
Expand Down Expand Up @@ -111,6 +113,26 @@ fn test_spawn_local_from_guard_other_thread() {
spawn_local(async {});
}

#[test]
#[cfg_attr(target_family = "wasm", ignore)] // threads not supported
fn test_spawn_local_panic() {
let rt = rt();
let local = LocalSet::new();

rt.block_on(local.run_until(async {
let thread_result = std::thread::spawn(|| {
let panic_result = panic::catch_unwind(|| {
let _jh = tokio::task::spawn_local(async {
println!("you will never see this line");
});
});
assert!(panic_result.is_err(), "Expected panic, but none occurred");
})
.join();
assert!(thread_result.is_ok(), "Thread itself panicked unexpectedly");
}));
}

fn rt() -> tokio::runtime::LocalRuntime {
tokio::runtime::Builder::new_current_thread()
.enable_all()
Expand Down
Loading
Loading