Skip to content

Compliance test case failures #146

@brandonchinn178

Description

@brandonchinn178

As of Jan 28 2025, kdl-rs fails the following test cases:

The "should pass" tests don't exist in this repo; they were added Jan 28 2025. The "should fail" tests do exist, but it doesn't look like they're actually checked in validate_res:

kdl-rs/tests/compliance.rs

Lines 76 to 111 in 268f3a2

fn validate_res(
res: Result<KdlDocument, KdlError>,
path: &Path,
src: &str,
) -> Result<(), ComplianceDiagnostic> {
let file_name = path.file_name().unwrap();
let expected_dir = path
.parent()
.unwrap()
.parent()
.unwrap()
.join("expected_kdl");
let expected_path = expected_dir.join(file_name);
let underscored = expected_dir.join(format!("_{}", PathBuf::from(file_name).display()));
if expected_path.exists() {
let doc = res.map_err(|e| ComplianceDiagnostic::KdlError(path.into(), e))?;
let expected = normalize_line_endings(fs::read_to_string(&expected_path)?);
let actual = stringify_to_expected(doc);
if actual != expected {
return Err(ComplianceDiagnostic::ExpectationMismatch {
file: path.into(),
original: src.into(),
expected: expected.replace('\n', "\\n").replace(" ", "."),
actual: actual.replace('\n', "\\n").replace(" ", "."),
});
}
} else if underscored.exists() {
eprintln!(
"skipped reserialization for {}",
PathBuf::from(file_name).display()
);
// } else {
// res.map_err(|e| ComplianceDiagnostic::KdlError(path.into(), e))?;
}
Ok(())
}

See also: https://github.com/brandonchinn178/kdl-test

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions