@@ -66,16 +66,35 @@ test("stop() flips the ctx alive flag off", async () => {
6666} ) ;
6767
6868test ( "sleep accepts zero milliseconds (no-op, synchronous)" , ( ) => {
69- assert . equal ( verb ( "sleep" ) ( { } , 0 ) , undefined ) ;
69+ assert . equal ( verb ( "sleep" ) ( { dryRun : false } , 0 ) , undefined ) ;
7070} ) ;
7171
7272test ( "sleep throws synchronously on a negative duration" , ( ) => {
7373 assert . throws (
74- ( ) => verb ( "sleep" ) ( { } , - 1 ) ,
74+ ( ) => verb ( "sleep" ) ( { dryRun : false } , - 1 ) ,
7575 / s l e e p \( m s \) r e q u i r e s a f i n i t e n o n - n e g a t i v e n u m b e r /
7676 ) ;
7777} ) ;
7878
79+ test ( "sleep in dry-run narrates without blocking" , ( ) => {
80+ const ctx = createCtx ( ) ;
81+ const originalWait = Atomics . wait ;
82+ let waited = false ;
83+ Atomics . wait = ( ) => {
84+ waited = true ;
85+ return "timed-out" ;
86+ } ;
87+
88+ try {
89+ assert . equal ( verb ( "sleep" ) ( ctx , 60_000 ) , undefined ) ;
90+ } finally {
91+ Atomics . wait = originalWait ;
92+ }
93+
94+ assert . equal ( waited , false ) ;
95+ assert . match ( ctx . lines . join ( "\n" ) , / w o u l d p a u s e f o r 6 0 0 0 0 m s / ) ;
96+ } ) ;
97+
7998test ( "the vocabulary exposes summaries for `moshcode commands`" , ( ) => {
8099 for ( const cmd of moshVocabulary ( ) . all ( ) ) {
81100 assert . equal ( typeof cmd . name , "string" ) ;
0 commit comments