1. Serge Zaitsev
  2. jsmn

Pull requests

#3 Declined
Repository
Deleted repository
Branch
default (3456e92ed403)
Repository
jsmn
Branch
default

include .h instead of .c in test

Author
  1. Hernan Echegoyemberry
Reviewers
Description
No description
  • Learn about pull requests

Comments (1)

  1. Serge Zaitsev repo owner

    Including .c instead of .h has some advantages. I would even say it's a common practice of unit-testing C code. If C module has some "static" functions - they won't be accessible (and thus, tested) outside the module. So, building a library and including a header allows only the black-box testing.

    Yes, I know that currently jsmn tests use only exported functions, but still prefer including *.c into test module. So if one day I decide to cover static functions with tests as well (I think I shall do it anyway) - that should be possible. I understand your approach looks more "pure", but I prefer a way that doesn't add limitations to testing.