test_that("missing path yields header error object", { path <- tempfile(fileext = ".vcf") x <- parse_vcf_header(path) expect_s3_class(x, "vcf_hdr") expect_true(length(x$errors) >= 1) expect_match(x$errors[[1]], "Empty or missing header") }) test_that("validator warns when no samples are detected", { tf <- tempfile(fileext = ".vcf") writeLines( c( "##fileformat=VCFv4.2", "##INFO=", "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO" ), tf ) x <- parse_vcf_header(tf) expect_true("No samples detected" %in% x$warnings) expect_equal(length(x$errors), 0) }) test_that("validator reports duplicate INFO IDs", { tf <- tempfile(fileext = ".vcf") writeLines( c( "##fileformat=VCFv4.2", "##INFO=", "##INFO=", "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO" ), tf ) x <- parse_vcf_header(tf) expect_true(any(grepl("Duplicate INFO IDs", x$warnings))) })