Skip to content

Make compiletests (run-pass, compile-fail, etc) usable for testing arbitrary rust programs #20458

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Manishearth opened this issue Jan 3, 2015 · 7 comments
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc

Comments

@Manishearth
Copy link
Member

Custom lints and syntax extensions would benefit from some in built support for testing.

@shepmaster
Copy link
Member

If I understand this correctly, we would be able to write our own tests that ensure that a certain piece of code should not compile? If so, I'm in favor!.

@brson brson added the A-testsuite Area: The testsuite used to check the correctness of rustc label Jan 3, 2015
@brson
Copy link
Contributor

brson commented Jan 3, 2015

I'm a little unclear on what's desired here. Is support for testing that compilation fails the primary thing?

Cargo can test standalone executables already. Would adding a 'compile-fail' mode to Cargo be sufficient, or is there really a need to distribute a standalone compiletest exe?

compiletest is super-crufty (it's some of the oldest rust code in existence!) and currently tailored very specifically to rustc's in-tree needs.

@shepmaster
Copy link
Member

For my cases, something built into Cargo that says "this line should fail to compile with this error" would be more than sufficient. I don't want to claim that's what @Manishearth wants though 😸

@Manishearth
Copy link
Member Author

Well, also the matching comments with warnings would be nice.

We could also redesign the compile tests to be more similar to the #[test] system and provide most of the functionality it used to.

@huonw
Copy link
Member

huonw commented Jan 21, 2015

Is this a dupe of #12335?

@gnzlbg
Copy link
Contributor

gnzlbg commented Jan 21, 2015

I think something like:

#[test]   // or #[compile_test]
#[should_not_compile(expected = "compiler error message/error type")]
fn compile_test() {}

would be very useful, if it is integrated with cargo.

@Manishearth
Copy link
Member Author

dupe of #12335

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc
Projects
None yet
Development

No branches or pull requests

5 participants