Re: [PATCH v5 2/2] test-config: Add tests for the config_set API

2014-07-07 Thread Matthieu Moy
Ramkumar Ramachandra writes: > A couple of quick nits. > > Tanay Abhra wrote: >> +test_expect_success 'clear default config' ' >> + rm -f .git/config >> +' > > Unnecessary; a fresh temporary directory is created for each test run. Hmm, fresh, but not empty. Anyway, the next test does a ca

Re: [PATCH v5 2/2] test-config: Add tests for the config_set API

2014-07-06 Thread Ramkumar Ramachandra
A couple of quick nits. Tanay Abhra wrote: > +test_expect_success 'clear default config' ' > + rm -f .git/config > +' Unnecessary; a fresh temporary directory is created for each test run. > +test_expect_success 'initialize default config' ' You might want to mark this as "setup". -- To u

Re: [PATCH v5 2/2] test-config: Add tests for the config_set API

2014-07-06 Thread Matthieu Moy
Tanay Abhra writes: > diff --git a/test-config.c b/test-config.c > new file mode 100644 > index 000..45ccd0a > --- /dev/null > +++ b/test-config.c > @@ -0,0 +1,127 @@ > +#include "cache.h" > +#include "hashmap.h" Useless include, you're not using the hashmap directly. > +int main(int argc,

Re: [PATCH v5 2/2] test-config: Add tests for the config_set API

2014-07-06 Thread Matthieu Moy
Tanay Abhra writes: > +test_expect_success 'get value for a simple key' ' > + echo "very blue" >expect && > + test-config get_value core.penguin >actual && > + test_cmp expect actual > +' All these tests would greatly benefit from a helper like test_expect_config () { echo "

[PATCH v5 2/2] test-config: Add tests for the config_set API

2014-07-06 Thread Tanay Abhra
Expose the `config_set` C API as a set of simple commands in order to facilitate testing. Add tests for the `config_set` API as well as for `git_config_get_*()` family for the usual config files. Signed-off-by: Tanay Abhra --- .gitignore | 1 + Makefile | 1 + t/t13