xref: /DADK/dadk-config/tests/test_dadk_manifest.rs (revision e2cc487b9b00279c1bb550f2e614bac16a38120f)
1 use dadk_config::{self, manifest::DadkManifest};
2 use test_base::{
3     dadk_config::DadkConfigTestContext,
4     test_context::{self as test_context, test_context},
5 };
6 
7 const TEMPLATES_DIR: &str = "templates";
8 const DADK_MANIFEST_FILE_NAME: &str = "dadk-manifest.toml";
9 
10 /// 测试加载模板目录中的 dadk-manifest.toml 文件,验证它能被加载成功,并且已经包含了所有字段
11 #[test_context(DadkConfigTestContext)]
12 #[test]
13 fn test_load_dadk_manifest_template(ctx: &DadkConfigTestContext) {
14     let manifest_path = ctx.abs_path(&format!("{TEMPLATES_DIR}/{DADK_MANIFEST_FILE_NAME}"));
15     assert_eq!(manifest_path.exists(), true);
16     assert_eq!(manifest_path.is_file(), true);
17     let manifest = DadkManifest::load(&manifest_path).expect("Failed to load manifest");
18     assert_eq!(manifest.used_default, false);
19 }
20