Skip to content

Commit 4609809

Browse files
committed
Async.Promise: test Bugfix: check state after wait
1 parent 1d77b74 commit 4609809

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

test/Async/Promise.vimspec

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function! s:wait_has_key_with_timeout(obj, name, timeout_sec) abort
1111
endif
1212
let i += 1
1313
endwhile
14-
throw printf("s:wait_has_key(): After 5000ms, the given object does not have key '%s': %s", a:name, a:obj)
14+
throw printf("s:wait_has_key(): After %ds, the given object does not have key '%s': %s", a:timeout_sec, a:name, a:obj)
1515
endfunction
1616

1717
function! s:resolver(resolve, reject) abort
@@ -604,28 +604,16 @@ Describe Async.Promise
604604
endfor
605605
End
606606

607-
It should create resolved Promise with given Promise value (without Wait())
607+
It should create resolved Promise with given Promise value
608608
for p in [
609609
\ P.resolve(P.resolve(42)),
610610
\ P.resolve(P.resolve(P.resolve(P.resolve(42)))),
611+
\ P.resolve(Wait(10).then({-> 42}))
611612
\ ]
612-
Assert Equals(p._state, FULFILLED)
613613
let l = l:
614614
call p.then({x -> extend(l, {'result' : x})})
615615
call s:wait_has_key(l, 'result')
616-
Assert Equals(result, 42)
617-
unlet result
618-
endfor
619-
End
620-
621-
It creates resolved Promise with given Promise value (with Wait())
622-
for p in [
623-
\ P.resolve(Wait(10).then({-> 42}))
624-
\ ]
625616
Assert Equals(p._state, FULFILLED)
626-
let l = l:
627-
call p.then({x -> extend(l, {'result' : x})})
628-
call s:wait_has_key_with_timeout(l, 'result', 50) " 10 times longer than default
629617
Assert Equals(result, 42)
630618
unlet result
631619
endfor

0 commit comments

Comments
 (0)