Fix a few parsing bugs that can allow for silent truncation of valid JSON
Test case for Redmine 6369

Shows that array data accumluates over multiple bundle
invocations.
Clear array data before calling bundle as method

This re-establishes the behavior from 3.5.3, where array
data within a sub-bundle does not accumulate accross
multiple bundle invokations via methods promises.

It maintains the behavior where such data does accumulate
accross multiple bundle invokations via bundlesequence.

One could argue that the behavior or data accumulating would
be consistent with the declarative nature of CFEngine, but
given that CFEngine provides no means to clear an array in a
controlled way, this would require a uniquely named array for
each bundle invocation, which would be unmaintainable and render
methods promises and bundles useless as a means for abstraction.

Fixes Redmine #6369, see ticket for more detailed discussion.
Disable caching for functions that populate array

The function populates an array, so skipping the function call
is not an option, as the cached return value is not sufficient.

A second call of the same method (2nd pass) would first clear
the array and then skip the function call, leaving an empty
array.
Hard error on JSON truncation
Fix for dash shell.
Merge branch 'bug/json-parser' of git://github.com/worr/core
Add unit test cases for trailing commas in JSON structures.
Merge pull request #2010 from vohi/redmine/6369

Redmine/6369
Fix incorrect test count calculation on Solaris 11.

`wc -l` on Solaris returns a number with some padded spaces around it,
which sh doesn't like when comparing numbers later on, so the result
is wrong. This caused the script to return success, when it should
have returned failure.
Update test result status for Solaris 11.

All cf-serverd tests are passing now, yey! Also remove freebsd, since
we don't test it in Jenkins, and the mentioned Redmine ticket is not
for that platform.
Fix testall always succeeding, even when there are failed tests.

We trap EXIT, so make sure we keep the return code.
Merge pull request #2011 from worr/bug/json-truncation

Hard error on JSON truncation
Revert "Fix testall always succeeding, even when there are failed tests."

This reverts commit 0013fd83bb8c494dd0ca42c75c0384e4d2f6bc5a.

Apparently relying on the $? variable inside a trap handler doesn't
work in all shells (Solaris).

New fix will follow.
Fix testall returning success even when there are failures.

The trap handler hides the exit code, so don't use it unless we have
to.