decdn-common 0.1.0

Shared types for deCDN binaries: config schema, identity, CLI args
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use super::{default_client_data_dir, default_data_dir};
use std::ffi::OsStr;

#[test]
fn client_data_dir_is_client_subdir_of_data_dir() {
    // Home-independent: whatever the base data dir resolves to (or `None`),
    // the client dir is its `client` subdirectory. Guards against a silent
    // revert to the node-shaped data dir or a wrong subdir name.
    match (default_data_dir(), default_client_data_dir()) {
        (Some(base), Some(client)) => {
            assert_eq!(client.file_name(), Some(OsStr::new("client")));
            assert_eq!(client.parent(), Some(base.as_path()));
        }
        (None, None) => {} // no home available; both absent, consistent
        other => panic!("data-dir/client-dir availability mismatch: {other:?}"),
    }
}