MCPcopy Create free account
hub / github.com/Moosync/Moosync / test_save_and_load_selective

Function test_save_and_load_selective

src-tauri/preferences/src/test.rs:78–104  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

76
77#[test]
78fn test_save_and_load_selective() -> Result<()> {
79 let test_dir = setup_test_dir();
80
81 let prefs = PreferenceConfig::new(test_dir.clone())?;
82
83 // Create test data
84 let test_data = TestConfig {
85 string_value: "test".to_string(),
86 number_value: 42,
87 boolean_value: true,
88 };
89
90 // Save data
91 prefs.save_selective("test_key".to_string(), Some(test_data.clone()))?;
92
93 // Load data
94 let loaded_data: TestConfig = prefs.load_selective("test_key".to_string())?;
95
96 // Verify data
97 assert_eq!(
98 loaded_data, test_data,
99 "Loaded data should match saved data"
100 );
101
102 cleanup_test_dir(test_dir);
103 Ok(())
104}
105
106#[test]
107fn test_save_and_load_array() -> Result<()> {

Callers

nothing calls this directly

Calls 5

setup_test_dirFunction · 0.85
cleanup_test_dirFunction · 0.85
cloneMethod · 0.80
save_selectiveMethod · 0.80
load_selectiveMethod · 0.80

Tested by

no test coverage detected