[cfe-dev] Positive tests in the clang test suite?

Joel Jacobson via cfe-dev cfe-dev at lists.llvm.org
Thu Jan 18 07:46:26 PST 2018


Dear Clang hackers,

I'm trying to understand how Clang is tested,
I've looked at lots of .c and .cpp files in ./test/,
and I see a lot of "// expected-warning" and "// expected-error" annotations,
but I don't see any positive tests checking for expected values?

Other compilers such as rustc uses macros such as assert_eq, e.g.:
#[test]
fn test_extend_specialization() {
    let mut a = BinaryHeap::from(vec![-10, 1, 2, 3, 3]);
    let b = BinaryHeap::from(vec![-20, 5, 43]);

    a.extend(b);

    assert_eq!(a.into_sorted_vec(), [-20, -10, 1, 2, 3, 3, 5, 43]);
}

Is there any similar type of positive testing in Clang, or is the
testing mainly focused on checking for warnings and errors, and just
checking valid code compiles, but not actually checking the computed
resulting values?

Thanks for clarifying.

Best regards,

Joel Jacobson



More information about the cfe-dev mailing list