Commit 22d6e06 1 parent e63e6f1 commit 22d6e06 Copy full SHA for 22d6e06
File tree 1 file changed +28
-0
lines changed
1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -195,3 +195,31 @@ impl Config {
195
195
log4rs:: init_config ( config) . expect ( "Failed to init logging" ) ;
196
196
}
197
197
}
198
+
199
+ #[ cfg( test) ]
200
+ mod tests {
201
+ // use super::*;
202
+
203
+ #[ test]
204
+ #[ should_panic( expected = "config not initialized" ) ]
205
+ fn get_config_before_init ( ) {
206
+ super :: get ( ) ;
207
+ }
208
+ #[ test]
209
+ #[ should_panic(
210
+ expected = "Could not Create Config dir: Os { code: 13, kind: PermissionDenied, message: \" Permission denied\" }"
211
+ ) ]
212
+ fn init_with_faulty_path ( ) {
213
+ super :: init ( "/test" ) ;
214
+ }
215
+ #[ test]
216
+ fn init_with_no_path ( ) {
217
+ super :: init ( "" ) ;
218
+ }
219
+ #[ test]
220
+ #[ should_panic( expected = "Could not set global config!: failed to set config Config" ) ]
221
+ fn init_config_twice ( ) {
222
+ super :: init ( "" ) ;
223
+ super :: init ( "" ) ;
224
+ }
225
+ }
You can’t perform that action at this time.
0 commit comments