Improve the JSON C API (#3943)

* Added more details into documentation.
* Moved the C unit-test into its own file.
* Added extra test cases.
* Extended the API reference documentation with doctests.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
This commit is contained in:
Péter Gál
2020-07-01 14:50:39 +02:00
committed by GitHub
parent ca12a8f8f4
commit 0c61aee597
7 changed files with 280 additions and 83 deletions
+20
View File
@@ -42,6 +42,26 @@
} \
} while (0)
#define TEST_ASSERT_STR(EXPECTED, RESULT) \
do \
{ \
const char* __expected = (const char *) (EXPECTED); \
const char* __result = (const char *) (RESULT); \
if (strcmp(__expected, __result) != 0) \
{ \
jerry_port_log (JERRY_LOG_LEVEL_ERROR, \
"TEST: String comparison failed at %s(%s):%lu.\n" \
" Expected: '%s'\n Got: '%s'\n", \
__FILE__, \
__func__, \
(unsigned long) __LINE__, \
__expected, \
__result); \
jerry_port_fatal (ERR_FAILED_INTERNAL_ASSERTION); \
\
} \
} while (0)
/**
* Test initialization statement that should be included
* at the beginning of main function in every unit test.