1 /* -*- Mode: C; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the Mozilla Public License Version 2.0.
7 // See license.mkd for licensing and copyright information.
8 // -------------------------------------------------------------------------*/
18 * Tests the opening and closing of Zip files.
22 SJME_TEST_DECLARE(testZipOpenClose
)
27 /* Attempt open of Zip. */
29 if (sjme_error_is(sjme_zip_openMemory(test
->pool
, &zip
,
30 mock_jar__bin
, mock_jar__len
)) || zip
== NULL
)
31 return sjme_unit_fail(test
, "Could not open Zip");
33 /* Reference up, since the Zip is valid. */
34 if (sjme_error_is(sjme_alloc_weakRef(zip
, NULL
)))
35 return sjme_unit_fail(test
, "Could not count up Zip?");
37 /* Immediately close it without doing anything. */
38 if (sjme_error_is(error
= sjme_closeable_close(
39 SJME_AS_CLOSEABLE(zip
))))
40 return sjme_unit_fail(test
, "Could not close Zip: %d", error
);
43 return SJME_TEST_RESULT_PASS
;