in src/producer.rs [682:805]
fn test_dir_producer() {
let (sender, receiver) = unbounded();
let tmp_dir = tempfile::tempdir().expect("Failed to create temporary directory");
let tmp_path = tmp_dir.path().to_owned();
let mapping = producer(&tmp_path, &["test".to_string()], &sender, false, false);
let expected = vec![
(ItemFormat::Gcno, true, "Platform_1.gcno", true),
(
ItemFormat::Gcno,
true,
"sub2/RootAccessibleWrap_1.gcno",
true,
),
(ItemFormat::Gcno, true, "nsMaiInterfaceValue_1.gcno", true),
(ItemFormat::Gcno, true, "sub/prova2_1.gcno", true),
(
ItemFormat::Gcno,
true,
"nsMaiInterfaceDocument_1.gcno",
true,
),
(
ItemFormat::Gcno,
true,
"Unified_cpp_netwerk_base0_1.gcno",
true,
),
(ItemFormat::Gcno, true, "prova_1.gcno", true),
(ItemFormat::Gcno, true, "nsGnomeModule_1.gcno", true),
(ItemFormat::Gcno, true, "negative_counts_1.gcno", true),
(ItemFormat::Gcno, true, "64bit_count_1.gcno", true),
(ItemFormat::Gcno, true, "no_gcda/main_1.gcno", false),
(ItemFormat::Gcno, true, "only_one_gcda/main_1.gcno", true),
(ItemFormat::Gcno, true, "only_one_gcda/orphan_1.gcno", false),
(
ItemFormat::Gcno,
true,
"gcno_symlink/gcda/main_1.gcno",
true,
),
(
ItemFormat::Gcno,
true,
"gcno_symlink/gcno/main_1.gcno",
false,
),
(
ItemFormat::Gcno,
false,
"rust/generics_with_two_parameters",
true,
),
(ItemFormat::Gcno, true, "reader_gcc-6_1.gcno", true),
(ItemFormat::Gcno, true, "reader_gcc-7_1.gcno", true),
(ItemFormat::Gcno, true, "reader_gcc-8_1.gcno", true),
(ItemFormat::Gcno, true, "reader_gcc-9_1.gcno", true),
(ItemFormat::Gcno, true, "reader_gcc-10_1.gcno", true),
(ItemFormat::Info, false, "1494603973-2977-7.info", false),
(ItemFormat::Info, false, "prova.info", false),
(ItemFormat::Info, false, "prova_fn_with_commas.info", false),
(ItemFormat::Info, false, "empty_line.info", false),
(ItemFormat::Info, false, "invalid_DA_record.info", false),
(
ItemFormat::Info,
false,
"relative_path/relative_path.info",
false,
),
(ItemFormat::Gcno, false, "llvm/file", true),
(ItemFormat::Gcno, false, "llvm/file_branch", true),
(ItemFormat::Gcno, false, "llvm/reader", true),
(
ItemFormat::JacocoXml,
false,
"jacoco/basic-jacoco.xml",
false,
),
(
ItemFormat::JacocoXml,
false,
"jacoco/inner-classes.xml",
false,
),
(
ItemFormat::JacocoXml,
false,
"jacoco/multiple-top-level-classes.xml",
false,
),
(
ItemFormat::JacocoXml,
false,
"jacoco/full-junit4-report-multiple-top-level-classes.xml",
false,
),
(
ItemFormat::JacocoXml,
false,
"jacoco/kotlin-jacoco-report.xml",
false,
),
(ItemFormat::Profraw, true, "default_1.profraw", false),
(
ItemFormat::Gcno,
true,
"mozillavpn_serverconnection_1.gcno",
true,
),
];
check_produced(tmp_path, &receiver, expected);
assert!(mapping.is_some());
let mapping: Value = serde_json::from_slice(&mapping.unwrap()).unwrap();
assert_eq!(
mapping
.get("dist/include/zlib.h")
.unwrap()
.as_str()
.unwrap(),
"modules/zlib/src/zlib.h"
);
}