This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch GROOVY-9381
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/GROOVY-9381 by this push:
     new e767cbe792 GROOVY-9381: Support async/await like ES7(backend)
e767cbe792 is described below

commit e767cbe79267be36e1651b4ec0753087f012fa8c
Author: Daniel Sun <[email protected]>
AuthorDate: Sun Oct 26 15:52:17 2025 +0900

    GROOVY-9381: Support async/await like ES7(backend)
---
 .../util/concurrent/async/SimplePromiseTest.groovy | 66 +++++++++++-----------
 1 file changed, 33 insertions(+), 33 deletions(-)

diff --git 
a/src/test/groovy/groovy/util/concurrent/async/SimplePromiseTest.groovy 
b/src/test/groovy/groovy/util/concurrent/async/SimplePromiseTest.groovy
index d7c7475f92..062a76c3eb 100644
--- a/src/test/groovy/groovy/util/concurrent/async/SimplePromiseTest.groovy
+++ b/src/test/groovy/groovy/util/concurrent/async/SimplePromiseTest.groovy
@@ -75,74 +75,74 @@ class SimplePromiseTest {
     class SimplePromiseCompletedPromiseTest {
         @Test
         void testCompletedPromiseWithValue() throws Exception {
-            Promise<Integer> p = SimplePromise.completedPromise(42);
+            Promise<Integer> p = SimplePromise.completedPromise(42)
 
-            assertTrue(p.isDone(), "promise should be done");
-            assertFalse(p.isCancelled(), "should not be cancelled");
-            assertFalse(p.isCompletedExceptionally(), "should not be completed 
exceptionally");
+            assertTrue(p.isDone(), "promise should be done")
+            assertFalse(p.isCancelled(), "should not be cancelled")
+            assertFalse(p.isCompletedExceptionally(), "should not be completed 
exceptionally")
 
             // blocking and non-blocking retrievals
-            assertEquals(42, p.join());
-            assertEquals(42, p.await());
-            assertEquals(42, p.get());
-            assertEquals(42, p.getNow(0));
-            assertEquals(42, p.toCompletableFuture().get());
-            assertEquals(42, p.get(1, TimeUnit.SECONDS));
+            assertEquals(42, p.join())
+            assertEquals(42, p.await())
+            assertEquals(42, p.get())
+            assertEquals(42, p.getNow(0))
+            assertEquals(42, p.toCompletableFuture().get())
+            assertEquals(42, p.get(1, TimeUnit.SECONDS))
 
             // attempting to cancel or complete an already-completed promise 
returns false
-            assertFalse(p.cancel(true));
-            assertFalse(p.complete(99));
+            assertFalse(p.cancel(true))
+            assertFalse(p.complete(99))
         }
 
         @Test
         void testCompletedPromiseWithNull() throws Exception {
-            Promise<Object> p = SimplePromise.completedPromise(null);
+            Promise<Object> p = SimplePromise.completedPromise(null)
 
-            assertTrue(p.isDone());
-            assertFalse(p.isCompletedExceptionally());
-            assertNull(p.join());
-            assertNull(p.await());
-            assertNull(p.getNow("absent"));
-            assertNull(p.toCompletableFuture().get());
+            assertTrue(p.isDone())
+            assertFalse(p.isCompletedExceptionally())
+            assertNull(p.join())
+            assertNull(p.await())
+            assertNull(p.getNow("absent"))
+            assertNull(p.toCompletableFuture().get())
         }
 
         @Test
         void testThenApplyOnCompletedPromise() {
-            Promise<Integer> p = SimplePromise.completedPromise(5);
+            Promise<Integer> p = SimplePromise.completedPromise(5)
 
-            Promise<Integer> mapped = p.thenApply(x -> x * 11);
+            Promise<Integer> mapped = p.thenApply(x -> x * 11)
 
             // mapping should produce the expected result immediately
-            assertEquals(55, mapped.join());
-            assertFalse(mapped.isCompletedExceptionally());
+            assertEquals(55, mapped.join())
+            assertFalse(mapped.isCompletedExceptionally())
         }
 
         @Test
         void testCompleteReturnsFalseAndObtrudeValueOverrides() {
-            Promise<Integer> p = SimplePromise.completedPromise(1);
+            Promise<Integer> p = SimplePromise.completedPromise(1)
 
             // cannot complete again
-            assertFalse(p.complete(2));
-            assertEquals(1, p.join());
+            assertFalse(p.complete(2))
+            assertEquals(1, p.join())
 
             // obtrudeValue forcibly changes the stored value
-            p.obtrudeValue(2);
-            assertEquals(2, p.join());
+            p.obtrudeValue(2)
+            assertEquals(2, p.join())
         }
 
         @Test
         void testObtrudeExceptionMakesPromiseExceptional() {
-            Promise<Integer> p = SimplePromise.completedPromise(3);
+            Promise<Integer> p = SimplePromise.completedPromise(3)
 
-            p.obtrudeException(new IllegalStateException("boom"));
+            p.obtrudeException(new IllegalStateException("boom"))
 
-            assertTrue(p.isCompletedExceptionally());
+            assertTrue(p.isCompletedExceptionally())
 
             // join throws CompletionException
-            assertThrows(CompletionException.class, p::join);
+            assertThrows(CompletionException.class, p::join)
 
             // await wraps thrown exception in AwaitException
-            assertThrows(AwaitException.class, p::await);
+            assertThrows(AwaitException.class, p::await)
         }
     }
 

Reply via email to