func/subr UT

This commit is contained in:
John Kerl 2016-09-10 22:47:55 -04:00
parent 8b9b352c9b
commit b4d42916db
2 changed files with 27 additions and 0 deletions

View file

@ -9,6 +9,7 @@ typedef struct _lrec_writer_json_state_t {
char* output_json_flatten_separator;
int quote_json_values_always;
char* line_indent;
char* before_records_at_start_of_stream;
char* between_records_after_start_of_stream;
char* after_records_at_end_of_stream;
@ -30,6 +31,7 @@ lrec_writer_t* lrec_writer_json_alloc(int stack_vertically, int wrap_json_output
pstate->counter = 0;
pstate->output_json_flatten_separator = output_json_flatten_separator;
pstate->line_indent = wrap_json_output_in_outer_list ? " " : "";
pstate->before_records_at_start_of_stream = wrap_json_output_in_outer_list ? "[\n" : "";
pstate->between_records_after_start_of_stream = wrap_json_output_in_outer_list ? "," : "";
pstate->after_records_at_end_of_stream = wrap_json_output_in_outer_list ? "]\n" : "";

View file

@ -33244,6 +33244,31 @@ zee wye 8 0.5985540091064224 0.976181385699006 9.574735 8
hat wye 9 0.03144187646093577 0.7495507603507059 9.780993 9
pan wye 10 0.5026260055412137 0.9526183602969864 11.455244 10
mlr --from ./reg_test/input/abixy put
func f(x,y,z) {
return x + y + z
}
subr s(a,b) {
$[a] = b;
return 1 # subr must not return value
}
$o = f($x, $y, $i);
call s("W", NR);
mlr: return statements within user-defined subroutines must not return a value.
mlr --from ./reg_test/input/abixy put
func f(x,y,z) {
return # func must return value
}
subr s(a,b) {
$[a] = b;
}
$o = f($x, $y, $i);
call s("W", NR);
mlr: return statements within user-defined functions must return a value.
================================================================
MULTI-PART SCRIPTS