Skip to content

Commit

Permalink
Add a single thread mutex for the ijson unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
iddm committed Mar 11, 2024
1 parent ea4b5e9 commit dd75e4a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions redis_json/src/ivalue_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -716,8 +716,12 @@ impl<'a> Manager for RedisIValueJsonKeyManager<'a> {
mod tests {
use super::*;

static single_thread_test_mutex: std::sync::Mutex<()> = std::sync::Mutex::new(());

#[test]
fn test_get_memory() {
let _guard = single_thread_test_mutex.lock();

let manager = RedisIValueJsonKeyManager {
phantom: PhantomData,
};
Expand Down Expand Up @@ -746,6 +750,8 @@ mod tests {
/// unicode characters well.
#[test]
fn test_unicode_characters() {
let _guard = single_thread_test_mutex.lock();

let json = r#""\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0""#;
let value: IValue = serde_json::from_str(json).expect("IValue parses fine.");
assert_eq!(
Expand Down

0 comments on commit dd75e4a

Please sign in to comment.