0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2024-12-28 10:09:25 -05:00

Fix race condition in v8::platform::Task tests (#355)

This commit is contained in:
Bert Belder 2020-04-16 15:08:51 +02:00
parent 3d0a90c1c8
commit d3a6c1403b
No known key found for this signature in database
GPG key ID: 7A77887B2E2ED461

View file

@ -208,21 +208,21 @@ mod tests {
}
#[test]
fn test_task_1() {
let mut task = TestTask::new();
task.run();
drop(task);
assert_eq!(RUN_COUNT.swap(0, SeqCst), 1);
assert_eq!(DROP_COUNT.swap(0, SeqCst), 1);
}
#[test]
fn test_task_2() {
let mut task = Box::new(TestTask::new()).into_unique_ref();
task.run();
task.run();
drop(task);
assert_eq!(RUN_COUNT.swap(0, SeqCst), 2);
assert_eq!(DROP_COUNT.swap(0, SeqCst), 1);
fn test_task() {
{
let mut task = TestTask::new();
task.run();
drop(task);
assert_eq!(RUN_COUNT.swap(0, SeqCst), 1);
assert_eq!(DROP_COUNT.swap(0, SeqCst), 1);
}
{
let mut task = Box::new(TestTask::new()).into_unique_ref();
task.run();
task.run();
drop(task);
assert_eq!(RUN_COUNT.swap(0, SeqCst), 2);
assert_eq!(DROP_COUNT.swap(0, SeqCst), 1);
}
}
}