@@ -33,12 +33,14 @@ defmodule ExUnit.Server do
33
33
## Callbacks
34
34
35
35
def init ( :ok ) do
36
- { :ok , % {
37
- loaded: System . monotonic_time ,
36
+ state = % {
37
+ loaded: System . monotonic_time ( ) ,
38
38
waiting: nil ,
39
39
async_modules: [ ] ,
40
- sync_modules: [ ] ,
41
- } }
40
+ sync_modules: [ ]
41
+ }
42
+
43
+ { :ok , state }
42
44
end
43
45
44
46
# Called on demand until we are signaled all modules are loaded.
@@ -47,13 +49,13 @@ defmodule ExUnit.Server do
47
49
end
48
50
49
51
# Called once after all async modules have been sent and reverts the state.
50
- def handle_call ( :take_sync_modules , _from , % { waiting: nil , loaded: :done , async_modules: [ ] } = state ) do
51
- { :reply , state . sync_modules ,
52
- % { state | sync_modules: [ ] , loaded: System . monotonic_time } }
52
+ def handle_call ( :take_sync_modules , from , state ) do
53
+ % { waiting: nil , loaded: :done , async_modules: [ ] } = state
54
+ { :reply , state . sync_modules , % { state | sync_modules: [ ] , loaded: System . monotonic_time ( ) } }
53
55
end
54
56
55
57
def handle_call ( :modules_loaded , _from , % { loaded: loaded } = state ) when is_integer ( loaded ) do
56
- diff = System . convert_time_unit ( System . monotonic_time - loaded , :native , :microsecond )
58
+ diff = System . convert_time_unit ( System . monotonic_time ( ) - loaded , :native , :microsecond )
57
59
{ :reply , diff , take_modules ( % { state | loaded: :done } ) }
58
60
end
59
61
0 commit comments