From 486dc80e5c1e4edd3ca598869808fdfc83d178f2 Mon Sep 17 00:00:00 2001 From: John Kerl Date: Mon, 12 Sep 2016 08:31:06 -0700 Subject: [PATCH] func/subr UT --- c/reg_test/expected/out | 7 +++++-- c/reg_test/run | 6 +----- c/todo.txt | 3 +++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/c/reg_test/expected/out b/c/reg_test/expected/out index 2c1873894..ccbdf0b1e 100644 --- a/c/reg_test/expected/out +++ b/c/reg_test/expected/out @@ -33184,6 +33184,9 @@ zee wye 8 0.5985540091064224 0.976181385699006 8000.598554 hat wye 9 0.03144187646093577 0.7495507603507059 9000.031442 pan wye 10 0.5026260055412137 0.9526183602969864 10000.502626 +mlr --opprint --from ./reg_test/input/abixy put func f(x,y,z){$nnn=999; local n=10; return $y} $o=f($i,$x,$y) +mlr: assignments to $-variables are not valid within func blocks. + mlr --opprint --from ./reg_test/input/abixy put subr s(a,b) { $[a] = b } call s("W", 999) a b i x y W pan pan 1 0.3467901443380824 0.7268028627434533 999 @@ -33269,7 +33272,7 @@ mlr --from ./reg_test/input/abixy put mlr: return statements within user-defined functions must return a value. -mlr --from s --opprint put func f(x) {return k} for (k,v in $*) {$o=f($x)} +mlr --from ./reg_test/input/abixy --opprint put func f(x) {return k} for (k,v in $*) {$o=f($x)} a b i x y pan pan 1 0.3467901443380824 0.7268028627434533 eks pan 2 0.7586799647899636 0.5221511083334797 @@ -33282,7 +33285,7 @@ zee wye 8 0.5985540091064224 0.976181385699006 hat wye 9 0.03144187646093577 0.7495507603507059 pan wye 10 0.5026260055412137 0.9526183602969864 -mlr --from s --opprint put subr foo() {print "k is [".k."]"} for (k,v in $*) {call foo()} +mlr --from ./reg_test/input/abixy --opprint put subr foo() {print "k is [".k."]"} for (k,v in $*) {call foo()} k is [] k is [] k is [] diff --git a/c/reg_test/run b/c/reg_test/run index 4cecf6fe0..cfbb63a90 100755 --- a/c/reg_test/run +++ b/c/reg_test/run @@ -1738,9 +1738,6 @@ run_mlr put -v '@["s"] = $x; emitp all' $indir/abixy run_mlr put -v '@["t"]["u"] = $y; emitp all' $indir/abixy -# xxx indirect from full srec -# xxx full srec from indirect - # xxx @* on the right # xxx @* on the left @@ -4608,8 +4605,7 @@ announce USER-DEFINED FUNCTIONS AND SUBROUTINES run_mlr --opprint --from $indir/abixy put 'func f(u,v){return u+v} $o=f(NR*1000,$x)' -# xxx expect fail -#run_mlr --opprint --from $indir/abixy put 'func f(x,y,z){$nnn=999; local n=10; return $y} $o=f($i,$x,$y)' +mlr_expect_fail --opprint --from $indir/abixy put 'func f(x,y,z){$nnn=999; local n=10; return $y} $o=f($i,$x,$y)' run_mlr --opprint --from $indir/abixy put 'subr s(a,b) { $[a] = b } call s("W", 999)' diff --git a/c/todo.txt b/c/todo.txt index a44a5468e..74faf980b 100644 --- a/c/todo.txt +++ b/c/todo.txt @@ -72,6 +72,9 @@ MORE: * inverse-transform-sampling example at cookbook. * 10-min +* final xxx check +* final valgrind check + ---------------------------------------------------------------- 4.6.0 ideas: