File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ mod tests {
51
51
use crate :: vfs:: { VendoredPathBuf , Vfs } ;
52
52
use crate :: { Db , Jar } ;
53
53
use salsa:: DebugWithDb ;
54
+ use std:: sync:: Arc ;
54
55
55
56
/// Database that can be used for testing.
56
57
///
@@ -81,8 +82,23 @@ mod tests {
81
82
& self . file_system
82
83
}
83
84
84
- pub ( crate ) fn events ( & self ) -> std:: sync:: Arc < std:: sync:: Mutex < Vec < salsa:: Event > > > {
85
- self . events . clone ( )
85
+ /// Takes the salsa events that have been emitted.
86
+ ///
87
+ /// ## Panics
88
+ /// If there are pending database snapshots.
89
+ pub ( crate ) fn take_salsa_events ( & mut self ) -> Vec < salsa:: Event > {
90
+ let inner = Arc :: get_mut ( & mut self . events )
91
+ . expect ( "expected no pending salsa database snapshots." ) ;
92
+
93
+ std:: mem:: take ( inner. get_mut ( ) . unwrap ( ) )
94
+ }
95
+
96
+ /// Clears the emitted salsa events.
97
+ ///
98
+ /// ## Panics
99
+ /// If there are pending database snapshots.
100
+ pub ( crate ) fn clear_salsa_events ( & mut self ) {
101
+ self . take_salsa_events ( ) ;
86
102
}
87
103
88
104
pub ( crate ) fn file_system_mut ( & mut self ) -> & mut MemoryFileSystem {
You can’t perform that action at this time.
0 commit comments