diff options
| author | Ben Blum <bblum@andrew.cmu.edu> | 2012-06-28 17:45:33 -0400 |
|---|---|---|
| committer | Ben Blum <bblum@andrew.cmu.edu> | 2012-06-28 17:45:48 -0400 |
| commit | 54713afa20a9e3cb09ffe678aeb7d32630ef7b59 (patch) | |
| tree | 58b23d21a1100c7f9cb241c55162f6781358288c | |
| parent | 59221e9ac886eb84437a4b94cd75db8ac8fa1161 (diff) | |
| download | rust-54713afa20a9e3cb09ffe678aeb7d32630ef7b59.tar.gz rust-54713afa20a9e3cb09ffe678aeb7d32630ef7b59.zip | |
add TLS failure test case in task.rs
| -rw-r--r-- | src/libcore/task.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/libcore/task.rs b/src/libcore/task.rs index 1d394ef560a..51f4a7c23cb 100644 --- a/src/libcore/task.rs +++ b/src/libcore/task.rs @@ -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; +} |
