diff options
author | Carlos Martín Nieto <carlos@cmartin.tk> | 2011-11-18 22:45:56 +0100 |
---|---|---|
committer | Carlos Martín Nieto <carlos@cmartin.tk> | 2011-11-18 22:45:56 +0100 |
commit | bdd31dd5e832126b2f22fccbe244a1106c241ab0 (patch) | |
tree | b08a2ad0fad57131563aa8c071221bea241128c1 /tests-clay/config/stress.c | |
parent | 277b7efe493887081ce1dafd91199d0ee9f676c9 (diff) | |
parent | e4c93a392763a006d11e1c1dd01c12f85498dad5 (diff) | |
download | libgit2-error-handling.tar.gz |
Merge branch 'development' into error-handlingerror-handling
The code in this branch has been modified so it works with the global
state introduced in development.
Diffstat (limited to 'tests-clay/config/stress.c')
-rw-r--r-- | tests-clay/config/stress.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests-clay/config/stress.c b/tests-clay/config/stress.c new file mode 100644 index 000000000..7b81400c1 --- /dev/null +++ b/tests-clay/config/stress.c @@ -0,0 +1,41 @@ +#include "clay_libgit2.h" + +#include "filebuf.h" +#include "fileops.h" +#include "posix.h" + +#define TEST_CONFIG "git-test-config" + +void test_config_stress__initialize(void) +{ + git_filebuf file; + + git_filebuf_open(&file, TEST_CONFIG, 0); + + git_filebuf_printf(&file, "[color]\n\tui = auto\n"); + git_filebuf_printf(&file, "[core]\n\teditor = \n"); + + git_filebuf_commit(&file, 0666); +} + +void test_config_stress__cleanup(void) +{ + p_unlink(TEST_CONFIG); +} + +void test_config_stress__dont_break_on_invalid_input(void) +{ + const char *editor, *color; + struct git_config_file *file; + git_config *config; + + cl_git_pass(git_futils_exists(TEST_CONFIG)); + cl_git_pass(git_config_file__ondisk(&file, TEST_CONFIG)); + cl_git_pass(git_config_new(&config)); + cl_git_pass(git_config_add_file(config, file, 0)); + + cl_git_pass(git_config_get_string(config, "color.ui", &color)); + cl_git_pass(git_config_get_string(config, "core.editor", &editor)); + + git_config_free(config); +} |