assert_string_equal() doesn't handle null, but a segfault is a test failure
so everything is good!


On Fri, Mar 14, 2014 at 10:46 AM, Edward Welbourne <notifications@github.com
> wrote:

> In tests/unit/addr_lib_test.c:
>
> > +    hostname = NULL; port = NULL;
> > +
> > +    ParseHostPort(xstrdup("www.cfengine.com:80"), &hostname, &port);
> > +    assert_string_equal(hostname, "www.cfengine.com");
> > +    assert_string_equal(port, "80");
> > +    hostname = NULL; port = NULL;
> > +
> > +    ParseHostPort(xstrdup("www.cfengine.com:"), &hostname, &port);
> > +    assert_string_equal(hostname, "www.cfengine.com");
> > +    assert_int_equal(port, NULL);
> > +    hostname = NULL; port = NULL;
> > +
> > +    ParseHostPort(xstrdup("[www.cfengine.com]"), &hostname, &port);
> > +    assert_string_equal(hostname, "www.cfengine.com");
> > +    assert_int_equal(port, NULL);
> > +    hostname = NULL; port = NULL;
>
> I guess the tests might need to be if (h) { assert_string_equal(h, host);
> } else { assert_int_equal(p, NULL); }, and similar for port, if
> assert_string_equally really doesn't handle NULL !
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/cfengine/core/pull/1555/files#r10601210>
> .
>