@@ -30,22 +30,23 @@ pub(crate) fn random_storage_path() -> PathBuf {
30
30
}
31
31
32
32
pub ( crate ) fn do_read_write_remove_list_persist < K : KVStoreSync + RefUnwindSafe > ( kv_store : & K ) {
33
- let data = [ 42u8 ; 32 ] ;
33
+ let data = vec ! [ 42u8 ; 32 ] ;
34
34
35
35
let primary_namespace = "testspace" ;
36
36
let secondary_namespace = "testsubspace" ;
37
37
let key = "testkey" ;
38
38
39
39
// Test the basic KVStore operations.
40
- kv_store. write ( primary_namespace, secondary_namespace, key, & data) . unwrap ( ) ;
40
+ kv_store. write ( primary_namespace, secondary_namespace, key, data. clone ( ) ) . unwrap ( ) ;
41
41
42
42
// Test empty primary/secondary namespaces are allowed, but not empty primary namespace and non-empty
43
43
// secondary primary_namespace, and not empty key.
44
- kv_store. write ( "" , "" , key, & data) . unwrap ( ) ;
45
- let res = std:: panic:: catch_unwind ( || kv_store. write ( "" , secondary_namespace, key, & data) ) ;
44
+ kv_store. write ( "" , "" , key, data. clone ( ) ) . unwrap ( ) ;
45
+ let res =
46
+ std:: panic:: catch_unwind ( || kv_store. write ( "" , secondary_namespace, key, data. clone ( ) ) ) ;
46
47
assert ! ( res. is_err( ) ) ;
47
48
let res = std:: panic:: catch_unwind ( || {
48
- kv_store. write ( primary_namespace, secondary_namespace, "" , & data)
49
+ kv_store. write ( primary_namespace, secondary_namespace, "" , data. clone ( ) )
49
50
} ) ;
50
51
assert ! ( res. is_err( ) ) ;
51
52
@@ -63,7 +64,7 @@ pub(crate) fn do_read_write_remove_list_persist<K: KVStoreSync + RefUnwindSafe>(
63
64
64
65
// Ensure we have no issue operating with primary_namespace/secondary_namespace/key being KVSTORE_NAMESPACE_KEY_MAX_LEN
65
66
let max_chars: String = std:: iter:: repeat ( 'A' ) . take ( KVSTORE_NAMESPACE_KEY_MAX_LEN ) . collect ( ) ;
66
- kv_store. write ( & max_chars, & max_chars, & max_chars, & data) . unwrap ( ) ;
67
+ kv_store. write ( & max_chars, & max_chars, & max_chars, data. clone ( ) ) . unwrap ( ) ;
67
68
68
69
let listed_keys = kv_store. list ( & max_chars, & max_chars) . unwrap ( ) ;
69
70
assert_eq ! ( listed_keys. len( ) , 1 ) ;
0 commit comments