mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 18:50:28 +09:00
tests: Check fgets output.
This commit is contained in:
@@ -47,6 +47,7 @@ static void teardown(void **state) {
|
|||||||
static void torture_knownhosts_port(void **state) {
|
static void torture_knownhosts_port(void **state) {
|
||||||
ssh_session session = *state;
|
ssh_session session = *state;
|
||||||
char buffer[200];
|
char buffer[200];
|
||||||
|
char *p;
|
||||||
FILE *file;
|
FILE *file;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
@@ -69,7 +70,8 @@ static void torture_knownhosts_port(void **state) {
|
|||||||
|
|
||||||
file = fopen(KNOWNHOSTFILES, "r");
|
file = fopen(KNOWNHOSTFILES, "r");
|
||||||
assert_true(file != NULL);
|
assert_true(file != NULL);
|
||||||
fgets(buffer, sizeof(buffer), file);
|
p = fgets(buffer, sizeof(buffer), file);
|
||||||
|
assert_false(p == NULL)
|
||||||
fclose(file);
|
fclose(file);
|
||||||
buffer[sizeof(buffer) - 1] = '\0';
|
buffer[sizeof(buffer) - 1] = '\0';
|
||||||
assert_true(strstr(buffer,"[localhost]:1234 ") != NULL);
|
assert_true(strstr(buffer,"[localhost]:1234 ") != NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user