Fix issue 36. Give each unit test a fresh configuration context - helps tests pass when a config file is passed in, which can

mess up the "expected" output, as this is testing loading
values into the configuration system.
remotes/origin/master-1.0.x
Jason Ish 15 years ago committed by Victor Julien
parent 749647a69d
commit 668b86cba4

@ -302,6 +302,9 @@ rule-files:\n\
default-log-dir: /tmp\n\ default-log-dir: /tmp\n\
"; ";
ConfCreateContextBackup();
ConfInit();
ConfNode *node; ConfNode *node;
ConfYamlLoadString(input, strlen(input)); ConfYamlLoadString(input, strlen(input));
node = ConfGetNode("rule-files"); node = ConfGetNode("rule-files");
@ -326,6 +329,9 @@ default-log-dir: /tmp\n\
i++; i++;
} }
ConfDeInit();
ConfRestoreContextBackup();
return 1; return 1;
} }
@ -342,6 +348,9 @@ logging:\n\
log-level: info\n\ log-level: info\n\
"; ";
ConfCreateContextBackup();
ConfInit();
ConfYamlLoadString(input, strlen(input)); ConfYamlLoadString(input, strlen(input));
ConfNode *outputs; ConfNode *outputs;
@ -393,6 +402,9 @@ logging:\n\
if (strcmp(output_param->val, "info") != 0) if (strcmp(output_param->val, "info") != 0)
return 0; return 0;
ConfDeInit();
ConfRestoreContextBackup();
return 1; return 1;
} }

Loading…
Cancel
Save