From 30a8dd4bdcbee897a320c0f1cb4ffc2fecfefb5f Mon Sep 17 00:00:00 2001 From: John Kerl Date: Thu, 29 Sep 2016 08:44:40 -0400 Subject: [PATCH] put/filter UT --- c/reg_test/expected/out | 48 +++++++++++++++++++++++++++++++++++++++++ c/reg_test/run | 21 ++++++++++++++++++ c/todo.txt | 2 -- 3 files changed, 69 insertions(+), 2 deletions(-) diff --git a/c/reg_test/expected/out b/c/reg_test/expected/out index 5ae37bb7c..aba3b5062 100644 --- a/c/reg_test/expected/out +++ b/c/reg_test/expected/out @@ -34830,6 +34830,54 @@ zee wye 8 0.5985540091064224 0.976181385699006 34 hat wye 9 0.03144187646093577 0.7495507603507059 55 pan wye 10 0.5026260055412137 0.9526183602969864 89 +mlr --from ./reg_test/input/abixy --opprint put func f(x) { begin {} } +mlr: begin statements are only valid at top level. + +mlr --from ./reg_test/input/abixy --opprint put func f(x) { end {} } +mlr: end statements are only valid at top level. + +mlr --from ./reg_test/input/abixy --opprint put subr s(x) { begin {} } +mlr: begin statements are only valid at top level. + +mlr --from ./reg_test/input/abixy --opprint put subr s(x) { end {} } +mlr: end statements are only valid at top level. + +mlr --from ./reg_test/input/abixy --opprint put func f(x) { func g(y) {} } +mlr: func statements are only valid at top level. + +mlr --from ./reg_test/input/abixy --opprint put func f(x) { subr t(y) {} } +mlr: subr statements are only valid at top level. + +mlr --from ./reg_test/input/abixy --opprint put subr s(x) { func g(y) {} } +mlr: func statements are only valid at top level. + +mlr --from ./reg_test/input/abixy --opprint put subr s(x) { subr t(y) {} } +mlr: subr statements are only valid at top level. + +mlr --from ./reg_test/input/abixy --opprint filter func f(x) { begin {} }; true +mlr: begin statements are only valid at top level. + +mlr --from ./reg_test/input/abixy --opprint filter func f(x) { end {} }; true +mlr: end statements are only valid at top level. + +mlr --from ./reg_test/input/abixy --opprint filter subr s(x) { begin {} }; true +mlr: begin statements are only valid at top level. + +mlr --from ./reg_test/input/abixy --opprint filter subr s(x) { end {} }; true +mlr: end statements are only valid at top level. + +mlr --from ./reg_test/input/abixy --opprint filter func f(x) { func g(y) {} }; true +mlr: func statements are only valid at top level. + +mlr --from ./reg_test/input/abixy --opprint filter func f(x) { subr t(y) {} }; true +mlr: subr statements are only valid at top level. + +mlr --from ./reg_test/input/abixy --opprint filter subr s(x) { func g(y) {} }; true +mlr: func statements are only valid at top level. + +mlr --from ./reg_test/input/abixy --opprint filter subr s(x) { subr t(y) {} }; true +mlr: subr statements are only valid at top level. + ================================================================ LOCALVAR SCOPE AND EXTENT diff --git a/c/reg_test/run b/c/reg_test/run index df28b1fb9..4e1e20af5 100755 --- a/c/reg_test/run +++ b/c/reg_test/run @@ -4883,6 +4883,27 @@ run_mlr --from $indir/abixy --opprint put ' $o = f(NR) ' +# No nesting of top-levels +mlr_expect_fail --from $indir/abixy --opprint put 'func f(x) { begin {} }' +mlr_expect_fail --from $indir/abixy --opprint put 'func f(x) { end {} }' +mlr_expect_fail --from $indir/abixy --opprint put 'subr s(x) { begin {} }' +mlr_expect_fail --from $indir/abixy --opprint put 'subr s(x) { end {} }' + +mlr_expect_fail --from $indir/abixy --opprint put 'func f(x) { func g(y) {} }' +mlr_expect_fail --from $indir/abixy --opprint put 'func f(x) { subr t(y) {} }' +mlr_expect_fail --from $indir/abixy --opprint put 'subr s(x) { func g(y) {} }' +mlr_expect_fail --from $indir/abixy --opprint put 'subr s(x) { subr t(y) {} }' + +mlr_expect_fail --from $indir/abixy --opprint filter 'func f(x) { begin {} }; true' +mlr_expect_fail --from $indir/abixy --opprint filter 'func f(x) { end {} }; true' +mlr_expect_fail --from $indir/abixy --opprint filter 'subr s(x) { begin {} }; true' +mlr_expect_fail --from $indir/abixy --opprint filter 'subr s(x) { end {} }; true' + +mlr_expect_fail --from $indir/abixy --opprint filter 'func f(x) { func g(y) {} }; true' +mlr_expect_fail --from $indir/abixy --opprint filter 'func f(x) { subr t(y) {} }; true' +mlr_expect_fail --from $indir/abixy --opprint filter 'subr s(x) { func g(y) {} }; true' +mlr_expect_fail --from $indir/abixy --opprint filter 'subr s(x) { subr t(y) {} }; true' + # ---------------------------------------------------------------- announce LOCALVAR SCOPE AND EXTENT diff --git a/c/todo.txt b/c/todo.txt index 39ebbb5fa..664da06d5 100644 --- a/c/todo.txt +++ b/c/todo.txt @@ -21,8 +21,6 @@ PRE-RELEASE 4.6.0: ---------------------------------------------------------------- UT FOR 4.6.0: -* no begin/end/func/subr within func -* no begin/end/func/subr within subr * print/printn zary * func tee, emitfx3, print, dump. * disallow func/subr redefines