MCPcopy Create free account
hub / github.com/git/git / test_strvec__detach

Function test_strvec__detach

t/unit-tests/u-strvec.c:299–316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

297}
298
299void test_strvec__detach(void)
300{
301 struct strvec vec = STRVEC_INIT;
302 const char **detached;
303
304 strvec_push(&vec, "foo");
305
306 detached = strvec_detach(&vec);
307 cl_assert_equal_s(detached[0], "foo");
308 cl_assert_equal_p(detached[1], NULL);
309
310 cl_assert_equal_p(vec.v, empty_strvec);
311 cl_assert_equal_i(vec.nr, 0);
312 cl_assert_equal_i(vec.alloc, 0);
313
314 free((char *) detached[0]);
315 free(detached);
316}

Callers

nothing calls this directly

Calls 2

strvec_pushFunction · 0.85
strvec_detachFunction · 0.85

Tested by

no test coverage detected