Skip to content

Commit 7f9850c

Browse files
LeeTibbertlolgab
andauthored
Quiet core/test "close multiple times" test (#31)
* Quiet core/test "close multiple times" test As folks may know better than I, in uTest individual tests are documented are documented as returning a value, which can itself be validated. If the return value is not Unit, it is printed out. Before this PR, the "close multiple times" test was returning the value of an object, which was getting printed out and adding something to the log which needed to be figured out as safe. This PR causes that test to be silent, thereby reducing clutter. Agreed, this is a nit. I think it is worth fixing because the present file may serve as a cut & paste template for additional tests as they are added. If I can not fix something useful, I can at least remove a small wart. * Make "close multiple times" return Future Before the timer was timing out after the test was declared successful. To preserve the semantics of utest a async test need to return the last Future to be completed as result Co-authored-by: Lorenzo Gabriele <[email protected]>
1 parent dfbd49c commit 7f9850c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

core/src/test/scala/scala/scalanative/loop/TimerTests.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,17 @@ object TimerTests extends LoopTestSuite {
5252
} yield ()
5353
}
5454
test("close multiple times") {
55+
val p = Promise[Unit]()
5556
val timer = Timer.timeout(10.millis)(() => {})
5657
timer.clear()
5758
timer.clear()
5859
global.execute(new Runnable { def run(): Unit = timer.clear() })
5960
Timer.timeout(50.millis) { () =>
6061
timer.clear()
6162
timer.clear()
63+
p.success(())
6264
}
65+
p.future
6366
}
6467
}
6568
}

0 commit comments

Comments
 (0)