blob: 21ef74d7dccb011c17450fee8d3084734f412a3a [file] [log] [blame]
Mårten Kongstad83a87602023-06-02 11:20:15 +02001/*
2 * Copyright (C) 2023 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#[cfg(test)]
18pub mod test_utils {
19 use crate::cache::Cache;
20 use crate::commands::{Input, Source};
21
22 pub fn create_cache() -> Cache {
23 crate::commands::create_cache(
Mårten Kongstadfbd71e22023-05-31 13:29:35 +020024 "com.android.aconfig.test",
Mårten Kongstad83a87602023-06-02 11:20:15 +020025 vec![Input {
26 source: Source::File("testdata/test.aconfig".to_string()),
27 reader: Box::new(include_bytes!("../testdata/test.aconfig").as_slice()),
28 }],
29 vec![
30 Input {
31 source: Source::File("testdata/first.values".to_string()),
32 reader: Box::new(include_bytes!("../testdata/first.values").as_slice()),
33 },
34 Input {
35 source: Source::File("testdata/test.aconfig".to_string()),
36 reader: Box::new(include_bytes!("../testdata/second.values").as_slice()),
37 },
38 ],
39 )
40 .unwrap()
41 }
42}
43
44#[cfg(test)]
45pub use test_utils::*;