2 * Copyright 2017, Andrew Lindesay <apl@lindesay.co.nz>
3 * Distributed under the terms of the MIT License.
5 #ifndef JSON_ERROR_HANDLING_TEST_H
6 #define JSON_ERROR_HANDLING_TEST_H
10 #include <TestSuite.h>
17 class JsonErrorHandlingTest
: public CppUnit::TestCase
{
19 JsonErrorHandlingTest();
20 virtual ~JsonErrorHandlingTest();
22 void TestCompletelyUnknown();
23 void TestObjectWithPrematureSeparator();
25 void TestStringUnterminated();
27 void TestBadStringEscape();
33 static void AddTests(BTestSuite
& suite
);
35 void TestParseWithUnexpectedCharacter(
36 const char* input
, int32 line
,
37 status_t expectedStatus
, char expectedChar
);
39 void TestParseWithUnterminatedElement(
40 const char* input
, int32 line
,
41 status_t expectedStatus
);
43 void TestParseWithBadStringEscape(
45 int32 line
, status_t expectedStatus
,
46 char expectedBadEscapeChar
);
48 void TestParseWithErrorMessage(
49 const char* input
, int32 line
,
50 status_t expectedStatus
,
51 const char* expectedMessage
);
53 void TestParseWithErrorMessage(
54 BDataIO
* data
, int32 line
,
55 status_t expectedStatus
,
56 const char* expectedMessage
);
61 #endif // JSON_ERROR_HANDLING_TEST_H