Skip to content

Commit 91b8015

Browse files
committed
Remove redundant code from tests
1 parent 349fefe commit 91b8015

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

tests/test-helpers-await.ss

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,12 @@
7070
(+ 5 10)))))
7171
(test-result 15 res)
7272
(print-result)
73-
(event-loop-quit! main-loop)
74-
(event-loop-block! #f main-loop))))
73+
;; we can apply event-loop-quit! here as we know the loop is running
74+
(event-loop-quit! main-loop))))
7575
(event-loop-run! main-loop)
7676

7777
;; Test 3: await-task-in-thread! with handler
7878

79-
(event-loop-block! #t main-loop)
8079
(a-sync (lambda (await resume)
8180
(let ((res
8281
(await-task-in-thread!
@@ -87,8 +86,8 @@
8786
5))))
8887
(test-result 5 res)
8988
(print-result)
90-
(event-loop-quit! main-loop)
91-
(event-loop-block! #f main-loop))))
89+
;; we can apply event-loop-quit! here as we know the loop is running
90+
(event-loop-quit! main-loop))))
9291
(event-loop-run! main-loop)
9392

9493
;; Test 4: await-task-in-event-loop!
@@ -567,8 +566,8 @@
567566
(+ 5 10)))))
568567
((no-await (test-result 15 res)
569568
(print-result)
570-
(event-loop-quit! main-loop)
571-
(event-loop-block! #f main-loop))))
569+
;; we can apply event-loop-quit! here as we know the loop is running
570+
(event-loop-quit! main-loop))))
572571
(event-loop-run! main-loop)
573572

574573
;;;;;;;;;; now the same tests with a default event loop ;;;;;;;;;;
@@ -600,27 +599,25 @@
600599
(+ 5 10)))))
601600
(test-result 15 res)
602601
(print-result)
603-
(event-loop-quit!)
604-
(event-loop-block! #f))))
602+
;; we can apply event-loop-quit! here as we know the loop is running
603+
(event-loop-quit!))))
605604
(event-loop-run!)
606605

607606
;; Test 24: await-task-in-thread! without handler (explicit loop argument)
608607

609-
(event-loop-block! #t)
610608
(a-sync (lambda (await resume)
611609
(let ((res
612610
(await-task-in-thread! await resume #f
613611
(lambda ()
614612
(+ 5 10)))))
615613
(test-result 15 res)
616614
(print-result)
617-
(event-loop-quit!)
618-
(event-loop-block! #f))))
615+
;; we can apply event-loop-quit! here as we know the loop is running
616+
(event-loop-quit!))))
619617
(event-loop-run!)
620618

621619
;; Test 25: await-task-in-thread! with handler
622620

623-
(event-loop-block! #t)
624621
(a-sync (lambda (await resume)
625622
(let ((res
626623
(await-task-in-thread!
@@ -631,8 +628,8 @@
631628
5))))
632629
(test-result 5 res)
633630
(print-result)
634-
(event-loop-quit!)
635-
(event-loop-block! #f))))
631+
;; we can apply event-loop-quit! here as we know the loop is running
632+
(event-loop-quit!))))
636633
(event-loop-run!)
637634

638635
;; Test 26: await-task-in-event-loop!
@@ -1120,6 +1117,6 @@
11201117
(+ 5 10)))))
11211118
((no-await (test-result 15 res)
11221119
(print-result)
1123-
(event-loop-quit!)
1124-
(event-loop-block! #f))))
1120+
;; we can apply event-loop-quit! here as we know the loop is running
1121+
(event-loop-quit!))))
11251122
(event-loop-run!)

0 commit comments

Comments
 (0)