0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2024-12-28 18:19:12 -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,16 +208,15 @@ mod tests {
} }
#[test] #[test]
fn test_task_1() { fn test_task() {
{
let mut task = TestTask::new(); let mut task = TestTask::new();
task.run(); task.run();
drop(task); drop(task);
assert_eq!(RUN_COUNT.swap(0, SeqCst), 1); assert_eq!(RUN_COUNT.swap(0, SeqCst), 1);
assert_eq!(DROP_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(); let mut task = Box::new(TestTask::new()).into_unique_ref();
task.run(); task.run();
task.run(); task.run();
@ -225,4 +224,5 @@ mod tests {
assert_eq!(RUN_COUNT.swap(0, SeqCst), 2); assert_eq!(RUN_COUNT.swap(0, SeqCst), 2);
assert_eq!(DROP_COUNT.swap(0, SeqCst), 1); assert_eq!(DROP_COUNT.swap(0, SeqCst), 1);
} }
}
} }