Gave the reader/writer test section a makeover.

This commit is contained in:
Aaron Jacobs 2014-07-01 13:11:05 +10:00
parent d61fa29da8
commit c151549937

View File

@ -174,21 +174,23 @@ Adding a reader/writer test
--------------------------- ---------------------------
To add a test, you need to create two files in test/data: To add a test, you need to create two files in test/data:
- a TESTNAME.json file, that contains the input document in JSON format.
- a TESTNAME.expected file, that contains a flatened representation of * a `TESTNAME.json` file, that contains the input document in JSON format.
the input document. * a `TESTNAME.expected` file, that contains a flatened representation of the
input document.
TESTNAME.expected file format:
- each line represents a JSON element of the element tree represented The `TESTNAME.expected` file format is as follows:
by the input document.
- each line has two parts: the path to access the element separated from * each line represents a JSON element of the element tree represented by the
the element value by '='. Array and object values are always empty input document.
(e.g. represented by either [] or {}). * each line has two parts: the path to access the element separated from the
- element path: '.' represented the root element, and is used to separate element value by `=`. Array and object values are always empty (i.e.
object members. [N] is used to specify the value of an array element represented by either `[]` or `{}`).
at index N. * element path: `.` represents the root element, and is used to separate object
See test_complex_01.json and test_complex_01.expected to better understand members. `[N]` is used to specify the value of an array element at index `N`.
element path.
See the examples `test_complex_01.json` and `test_complex_01.expected` to better
understand element paths.
Understanding reader/writer test output Understanding reader/writer test output