Add support for doctests (#1909)

Markdown files in the docs/ directory can now be annotated to turn
fenced C code blocks into unit tests. The recognized syntax is:

    [doctest]: # (name="test.c", test="run")

    ```c
    // unit test code
    ```

The commit also fixes the issues revealed during the initial
annotation.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
Akos Kiss
2017-07-14 16:18:20 +02:00
committed by GitHub
parent 3d744c958f
commit 00f93bc287
11 changed files with 468 additions and 50 deletions
+5 -2
View File
@@ -114,6 +114,8 @@ jerryx_handler_register_global (const jerry_char_t *name_p,
**Example**
[doctest]: # (test="compile")
```c
#include "jerryscript.h"
#include "jerryscript-ext/handler.h"
@@ -129,7 +131,8 @@ static const struct {
{ NULL, NULL }
};
static void register_common_functions ()
static void
register_common_functions (void)
{
jerry_value_t ret = jerry_create_undefined ();
@@ -139,7 +142,7 @@ static void register_common_functions ()
common_functions[i].handler_p);
}
return ret;
jerry_release_value (ret);
}
```