Refactored KLocalizedContext

Extracted everything from lib.rs
Also extracted all doc tests to integration tests.
This commit is contained in:
Ayush Singh 2021-12-01 17:34:45 +05:30
parent 0470f05c07
commit 38ebb314b8
6 changed files with 114 additions and 96 deletions

12
tests/common.rs Normal file
View file

@ -0,0 +1,12 @@
use lazy_static::lazy_static;
use std::sync::Mutex;
lazy_static! {
pub static ref TEST_MUTEX: Mutex<()> = Mutex::new(());
}
/// There can only be one thread running at the time with a QQuickEngine
/// (in principle, everything should be in the same main thread)
pub fn lock_for_test() -> std::sync::MutexGuard<'static, ()> {
TEST_MUTEX.lock().unwrap_or_else(|e| e.into_inner())
}