salsa-rs / salsa

A generic framework for on-demand, incrementalized computation. Inspired by adapton, glimmer, and rustc's query system.
https://salsa-rs.netlify.app/
Apache License 2.0
2.14k stars 152 forks source link

Exhaustive tests for macros and the options you can and cannot use at each place (the calc example uses only the "main" route, e.g. when jar is not specified explicitly) #354

Open nikomatsakis opened 2 years ago

nikomatsakis commented 2 years ago

We need to test all the various illegal macro options. As recommended by @XFFXFF, and demonstrated in #361, we are using the trybuild tool To add a new test, we simply add a file that contains an error, like this

https://github.com/salsa-rs/salsa/blob/8dfc578edc2c62cef84c49da247dc199b50740ae/salsa-2022-tests/tests/compile-fail/lru_can_not_be_used_with_specify.rs#L11-L14

You will also have to create a "stderr" file with the expected output. You don't have to do this by hand -- the workflow docs for trybuild explain how it works.

nikomatsakis commented 2 years ago

@XFFXFF added the lru option to tracked functions in https://github.com/salsa-rs/salsa/pull/352, but we should test that it cannot be used with specify somehow.

xffxff commented 2 years ago

https://github.com/dtolnay/trybuild.git
I found this crate useful and easy to use to test for compiling failures. I added a pr as an example to show how it works so you can see if this is the right way to go @nikomatsakis