From e3e56d9f7ea4710785ec4d3aef15bf5ca018ef43 Mon Sep 17 00:00:00 2001 From: Lars-Magnus Skog Date: Sat, 11 May 2019 17:51:35 +0200 Subject: [PATCH] Skip #[cfg(test)] and mod tests, not needed --- tests/stress.rs | 59 ++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 32 deletions(-) diff --git a/tests/stress.rs b/tests/stress.rs index cd67fd78e..f8964cae7 100644 --- a/tests/stress.rs +++ b/tests/stress.rs @@ -4467,40 +4467,35 @@ unsafe fn stress_functions(context: &dc_context_t) { }; } -#[cfg(test)] -mod tests { - use super::*; +unsafe extern "C" fn cb( + _context: &dc_context_t, + _event: Event, + _data1: uintptr_t, + _data2: uintptr_t, +) -> uintptr_t { + 0 +} - unsafe extern "C" fn cb( - _context: &dc_context_t, - _event: Event, - _data1: uintptr_t, - _data2: uintptr_t, - ) -> uintptr_t { - 0 - } +unsafe fn create_context() -> dc_context_t { + let mut ctx = dc_context_new(cb, std::ptr::null_mut(), std::ptr::null_mut()); + let dir = tempdir().unwrap(); + let dbfile = CString::new(dir.path().join("db.sqlite").to_str().unwrap()).unwrap(); + assert_eq!( + dc_open(&mut ctx, dbfile.as_ptr(), std::ptr::null()), + 1, + "Failed to open {}", + CStr::from_ptr(dbfile.as_ptr() as *const libc::c_char) + .to_str() + .unwrap() + ); - unsafe fn create_context() -> dc_context_t { - let mut ctx = dc_context_new(cb, std::ptr::null_mut(), std::ptr::null_mut()); - let dir = tempdir().unwrap(); - let dbfile = CString::new(dir.path().join("db.sqlite").to_str().unwrap()).unwrap(); - assert_eq!( - dc_open(&mut ctx, dbfile.as_ptr(), std::ptr::null()), - 1, - "Failed to open {}", - CStr::from_ptr(dbfile.as_ptr() as *const libc::c_char) - .to_str() - .unwrap() - ); + ctx +} - ctx - } - - #[test] - fn run_stress_tests() { - unsafe { - let ctx = create_context(); - stress_functions(&ctx); - } +#[test] +fn run_stress_tests() { + unsafe { + let ctx = create_context(); + stress_functions(&ctx); } }