diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-09-03 13:16:22 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-09-03 13:16:22 -0400 |
commit | eb5f22eff22745ad85741106215ee0831325c0bf (patch) | |
tree | 15805897f7370845fb76e1f47c27215e37247359 /src/test | |
parent | 824df4a08ec9af8d8ac6b4ecacc1a6fdbc87ac8b (diff) | |
parent | db318dc77f47157d685fdd9e2035c96574b283db (diff) | |
download | tor-eb5f22eff22745ad85741106215ee0831325c0bf.tar.gz tor-eb5f22eff22745ad85741106215ee0831325c0bf.zip |
Merge remote-tracking branch 'Ryman/bug4341'
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test_config.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/test/test_config.c b/src/test/test_config.c index 3848d352d5..911913aa8c 100644 --- a/src/test/test_config.c +++ b/src/test/test_config.c @@ -509,6 +509,41 @@ test_config_parse_transport_options_line(void *arg) } } +// Tests if an options with MyFamily fingerprints missing '$' normalises +// them correctly and also ensure it also works with multiple fingerprints +static void +test_config_fix_my_family(void *arg) +{ + char *err = NULL; + char *family = "$1111111111111111111111111111111111111111, " + "1111111111111111111111111111111111111112, " + "$1111111111111111111111111111111111111113"; + + or_options_t* options = options_new(); + or_options_t* defaults = options_new(); + options_init(options); + options_init(defaults); + options->MyFamily = tor_strdup(family); + + options_validate(NULL, options, defaults, 0, &err) ; + + if (err != NULL) { + test_fail_msg(err); + } + + test_streq(options->MyFamily, "$1111111111111111111111111111111111111111, " + "$1111111111111111111111111111111111111112, " + "$1111111111111111111111111111111111111113"); + + done: + if (err != NULL) { + tor_free(err); + } + + or_options_free(options); + or_options_free(defaults); +} + #define CONFIG_TEST(name, flags) \ { #name, test_config_ ## name, flags, NULL, NULL } @@ -518,6 +553,7 @@ struct testcase_t config_tests[] = { CONFIG_TEST(parse_transport_options_line, 0), CONFIG_TEST(check_or_create_data_subdir, TT_FORK), CONFIG_TEST(write_to_data_subdir, TT_FORK), + CONFIG_TEST(fix_my_family, 0), END_OF_TESTCASES }; |