1 /* Copyright (c) 2007 Eric Scott Albright
\r
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
\r
4 * of this software and associated documentation files (the "Software"), to deal
\r
5 * in the Software without restriction, including without limitation the rights
\r
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
\r
7 * copies of the Software, and to permit persons to whom the Software is
\r
8 * furnished to do so, subject to the following conditions:
\r
10 * The above copyright notice and this permission notice shall be included in
\r
11 * all copies or substantial portions of the Software.
\r
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
\r
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
\r
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
\r
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
\r
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
\r
22 #include <UnitTest++.h>
\r
23 #include <enchant.h>
\r
24 #include "../EnchantBrokerTestFixture.h"
\r
27 * enchant_broker_get_error
\r
28 * @broker: A non-null broker
\r
30 * Returns a const char string or NULL describing the last exception.
\r
31 * WARNING: error is transient and is likely cleared as soon as the
\r
32 * next broker operation happens
\r
36 /////////////////////////////////////////////////////////////////////////////
\r
37 // Test Normal Operation
\r
39 TEST_FIXTURE(EnchantBrokerTestFixture,
\r
40 EnchantBrokerGetError_HasPreviousError_Error)
\r
42 std::string errorMessage("something bad happened");
\r
43 SetErrorOnMockProvider(errorMessage);
\r
45 char * result = enchant_broker_get_error(_broker);
\r
49 CHECK_EQUAL(errorMessage.c_str(), result);
\r
53 TEST_FIXTURE(EnchantBrokerTestFixture,
\r
54 EnchantBrokerGetError_NoPreviousError_Null)
\r
56 CHECK_EQUAL((void*)NULL, (void*)enchant_broker_get_error(_broker));
\r
59 /////////////////////////////////////////////////////////////////////////////
\r
60 // Test Error Conditions
\r
62 TEST(EnchantBrokerGetError_NullBroker_Null)
\r
64 CHECK_EQUAL((void*)NULL, (void*)enchant_broker_get_error(NULL));
\r