[clangd-dev] clangd testcase style

Nathan Ridge via clangd-dev clangd-dev at lists.llvm.org
Tue Mar 10 12:49:26 PDT 2020


>> I realize this saves a bit of typing when writing the test cases,
> I don't think that quite covers it :-) Compared to how we used to 
> write unit tests, the main benefits are: [...]

Thanks for going over these benefits, they all make sense to me and are good to keep in mind when considering alternatives.

> The alternatives I've thought about:
>  - TEST_CASE_F with a fixture class. Considerably more boilerplatey. No forcing function to keep the structure the same for tests, so they tend to diverge somewhat.
>  - INSTANTIATE_TEST_CASE_P: my experience with this is it's a surprisingly badly designed piece of gtest that's painful to write, run, or understand tests in :-(
>  - Something custom for table driven tests. I'm imagining some hybrid of TEST_CASE_F and INSTANTIATE_TEST_CASE_P like TEST_INSTANCE(GoToDefTest, Heuristic, { ... table entry ... }). But needs some investigation.

I initially envisioned a fixture based approach, but you're right that we could further reduce boilerplate with a custom macro. I'll try to prototype something next time I need to write a test like this.

Thanks,
Nate


More information about the clangd-dev mailing list