Skip to content

Commit 457adf8

Browse files
committed
added documentation and little changes in jsn.php with no effect improved test.php
1 parent 8d2e3ea commit 457adf8

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

JSN-doc.pdf

232 KB
Binary file not shown.

jsn.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,10 @@ function check_name($name, $replacement, $allow_replace)
341341
{
342342
err(2); // problem with reading input file
343343
}
344+
if( ! is_object( $json_input = @ json_decode($json_input, false) ) && ! is_array($json_input) )
345+
{
346+
err(4); // bad json
347+
}
344348
if ( ( $xml_output = @ fopen($args['output'], 'w')) === false )
345349
{
346350
err(3); // problem with writing to file
@@ -349,10 +353,6 @@ function check_name($name, $replacement, $allow_replace)
349353
{
350354
@ fclose($xml_output);
351355
}
352-
if( ! is_object( $json_input = @ json_decode($json_input, false) ) && ! is_array($json_input) )
353-
{
354-
err(4); // bad json
355-
}
356356
// starting function writer
357357
@ write($json_input, $args);
358358
// end of script

tests/test.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ function diffArrays($aArray1, $aArray2)
6767
{ # code from commands
6868
echo "[ERR] Test " . $name . " failed with code: " . $returnCode . " expected: " . $code . "\n";
6969
$bad++;
70+
if ( $bad == 1)
71+
{
72+
$failedTests .= "$name";
73+
}
74+
else
75+
{
76+
$failedTests .= ", $name";
77+
}
7078
continue;
7179
}
7280
elseif ($returnCode == $code && $returnCode != 0)

0 commit comments

Comments
 (0)