mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-07-31 00:03:07 +03:00
tests: Prefer assert_non_null() over assert_false()
This also replaces some occurrences of assert_true() with assert_null() Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Andreas Schneider
parent
bdf968c178
commit
27caaa000b
@ -128,7 +128,7 @@ static void torture_knownhosts_port(void **state) {
|
||||
file = fopen(known_hosts_file, "r");
|
||||
assert_non_null(file);
|
||||
p = fgets(buffer, sizeof(buffer), file);
|
||||
assert_false(p == NULL);
|
||||
assert_non_null(p);
|
||||
fclose(file);
|
||||
buffer[sizeof(buffer) - 1] = '\0';
|
||||
assert_non_null(strstr(buffer,"[127.0.0.10]:1234 "));
|
||||
|
@ -66,7 +66,7 @@ static void torture_sftp_mkdir(void **state) {
|
||||
char tmpdir[128] = {0};
|
||||
int rc;
|
||||
|
||||
assert_false(t == NULL);
|
||||
assert_non_null(t);
|
||||
|
||||
snprintf(tmpdir, sizeof(tmpdir) - 1, "%s/mkdir_test", t->testdir);
|
||||
|
||||
|
@ -11,10 +11,10 @@ static void torture_sftp_ext_new(void **state) {
|
||||
(void) state;
|
||||
|
||||
x = sftp_ext_new();
|
||||
assert_false(x == NULL);
|
||||
assert_non_null(x);
|
||||
assert_int_equal(x->count, 0);
|
||||
assert_true(x->name == NULL);
|
||||
assert_true(x->data == NULL);
|
||||
assert_null(x->name);
|
||||
assert_null(x->data);
|
||||
|
||||
sftp_ext_free(x);
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ static int setup(void **state)
|
||||
struct ssh_callbacks_struct *cb;
|
||||
|
||||
cb = malloc(sizeof(struct ssh_callbacks_struct));
|
||||
assert_false(cb == NULL);
|
||||
assert_non_null(cb);
|
||||
ZERO_STRUCTP(cb);
|
||||
|
||||
cb->userdata = (void *) 0x0badc0de;
|
||||
|
@ -44,7 +44,7 @@ static void torture_get_user_home_dir(void **state) {
|
||||
(void) state;
|
||||
|
||||
user = ssh_get_user_home_dir();
|
||||
assert_false(user == NULL);
|
||||
assert_non_null(user);
|
||||
#ifndef _WIN32
|
||||
assert_string_equal(user, pwd->pw_dir);
|
||||
#endif /* _WIN32 */
|
||||
@ -109,7 +109,7 @@ static void torture_path_expand_tilde_win(void **state) {
|
||||
(void) state;
|
||||
|
||||
d = ssh_path_expand_tilde("~\\.ssh");
|
||||
assert_false(d == NULL);
|
||||
assert_non_null(d);
|
||||
print_message("Expanded path: %s\n", d);
|
||||
free(d);
|
||||
|
||||
|
Reference in New Issue
Block a user