1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
/*
* SNOOPY COMMAND LOGGER
*
* Copyright (c) 2015 Bostjan Skufca Jese <bostjan@a2o.si>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
* Includes order: from local to global
*/
#include "action-unit-error.h"
#include "action-common.h"
#include "snoopy.h"
#include "error.h"
#include "entrypoint/test-cli.h"
#include "configuration.h"
#include <stdio.h>
#include <string.h>
void snoopyTestCli_action_unit_error_showHelp ()
{
char * helpContent =
"Snoopy TEST SUITE CLI utility :: Action `unit` :: Unit `error`\n"
"\n"
"Description:\n"
" Mocks src/error.c implementation code paths (mainly for the coverage of code parts/paths not covered by the test suite).\n"
"\n"
"Usage:\n"
" snoopy-test unit error\n"
" snoopy-test unit error --help\n"
"\n";
printf("%s", helpContent);
}
int snoopyTestCli_action_unit_error (int argc, char ** argv)
{
const char *arg1;
if (argc > 0) {
arg1 = argv[0];
} else {
arg1 = "";
}
if (0 == strcmp(arg1, "--help")) {
snoopyTestCli_action_unit_error_showHelp();
return 0;
}
/* Initialize Snoopy */
snoopy_entrypoint_test_cli_init((char const *)g_argv[0], g_argv, NULL);
// Do the mocking
snoopy_configuration_t * CFG;
CFG = snoopy_configuration_get();
CFG->output = "stderr";
snoopy_error_handler("Test error message, sent out via stderr output.");
/* Cleanup */
snoopy_entrypoint_test_cli_exit();
printSuccess("Mocking src/error.c complete.");
return 0;
}
|