use std::collections::HashMap;
use std::path::PathBuf;
fn fixture_dir() -> PathBuf {
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/testdata/hocon/empty-file")
}
fn run_empty_file_fixture(name: &str) {
let path = fixture_dir().join(format!("{}.conf", name));
let env: HashMap<String, String> = HashMap::new();
let cfg = hocon::parse_file_with_env(&path, &env).unwrap_or_else(|e| {
panic!(
"S3.1 conformance: {}.conf must parse to {{}} per the expected sidecar, got error: {}",
name, e
)
});
let keys = cfg.keys();
assert!(
keys.is_empty(),
"S3.1 conformance: {}.conf must produce an empty config, got keys {:?}",
name,
keys
);
}
#[test]
fn ef01_empty() {
run_empty_file_fixture("ef01-empty");
}
#[test]
fn ef02_whitespace_only() {
run_empty_file_fixture("ef02-whitespace-only");
}
#[test]
fn ef03_newlines_only() {
run_empty_file_fixture("ef03-newlines-only");
}
#[test]
fn ef04_comment_only() {
run_empty_file_fixture("ef04-comment-only");
}
#[test]
fn ef05_bom_only() {
run_empty_file_fixture("ef05-bom-only");
}
#[test]
fn ef06_mixed_ws_comment() {
run_empty_file_fixture("ef06-mixed-ws-comment");
}