[PATCH] D25205: Add unit tests for StringSwitch.

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 3 11:54:54 PDT 2016


chandlerc accepted this revision.
chandlerc added a comment.
This revision is now accepted and ready to land.

I was all prepared to not like this approach for testing. But it looks really, really nice. I've got nothing to really suggest here other than some test cases you should probably add:

- purely length-delimited cases.
- edge cases with '\0' bytes in the middle of the string
  - '\0' in the middle of the case
  - '\0' in the middle of the input

For the latter: I think the formation of the StringRef will handle all of this and you'll just show that whatever length the StringRef has, that's the length that is used. But good to document this fact so folks don't go and switch the code to use strncmp for some weird reason.

Feel free to submit with whatever you come up with here.


https://reviews.llvm.org/D25205





More information about the llvm-commits mailing list