/*++ /* NAME /* mock_spawn_command 3t /* SUMMARY /* spawn_command() mocker /* SYNOPSIS /* #include <mock_spawn_command.h> /* /* typedef struct MOCK_SPAWN_CMD_REQ { /* struct spawn_args *want_args; /* int out_status; /* const char *out_text; P/* /* void setup_mock_spawn_command(const MOCK_SPAWN_CMD_REQ *request) /* DESCRIPTION /* setup_mock_spawn_command() instantiates a spawn_command() mocker, /* that given the expected inputs, will produce the specified /* outputs, without any additional dependencies or side effects. /* /* This implementation supports only one instance of expectations /* and outputs, and makes a shallow copy of its inputs: /* .IP want_args /* The inputs that the mock spawn_command() instance must /* receive. Otherwise, The mocker will terminate the test. /* .IP out_status /* The spawn_command() result value. /* .IP out_text /* Pointer to null-terminated text that will be written to the /* simulated command's standard error stream. /* SEE ALSO /* spawn_command(3), command spawner /* LICENSE /* .ad /* .fi /* The Secure Mailer license must be distributed with this software. /* AUTHOR(S) /* Wietse Venema /* porcupine.org
/*--*/
/* *Validatetheoutputrequirements.
*/ if (request->out_status == 0) { if (request->out_text != 0)
msg_fatal("setup_spawn_command: out_status is zero, but out_text " "is not null");
} else { if (request->out_text == 0 || *request->out_text == 0) {
msg_fatal("setup_spawn_command: out_status is not zero, but " "out_text is null or empty");
}
}
/* *Matchspawn_command()argumentsagainstexpectationsorterminate.
*/ if (!match_spawn_args(msg_warn, &mock_req.want_args, &got_args))
msg_fatal("spawn_command called with unexpected argument");
/* Now output some info as if the command was executed. */ if (mock_req.out_status != 0)
write(got_args.stderr_fd, mock_req.out_text, strlen(mock_req.out_text)); return (mock_req.out_status);
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet am 2026-08-08)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.