add TLS failure test case in task.rs
This commit is contained in:
parent
59221e9ac8
commit
54713afa20
1 changed files with 20 additions and 0 deletions
|
|
@ -1283,3 +1283,23 @@ fn test_tls_overwrite_multiple_types() unsafe {
|
|||
local_data_set(int_key, @31337);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_fail]
|
||||
#[ignore(cfg(windows))]
|
||||
fn test_tls_cleanup_on_failure() unsafe {
|
||||
fn str_key(+_x: @str) { }
|
||||
fn box_key(+_x: @@()) { }
|
||||
fn int_key(+_x: @int) { }
|
||||
local_data_set(str_key, @"parent data");
|
||||
local_data_set(box_key, @@());
|
||||
task::spawn{|| // spawn_linked
|
||||
local_data_set(str_key, @"string data");
|
||||
local_data_set(box_key, @@());
|
||||
local_data_set(int_key, @42);
|
||||
fail;
|
||||
}
|
||||
// Not quite nondeterministic.
|
||||
local_data_set(int_key, @31337);
|
||||
fail;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue