Parse and store javadoc-style docstrings at toplevel
[kaos.git] / t / 20script-classifiers.t
blob807880c9b6f384ad608292e597e91d5ae635fa82
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
5 use Test::Kaos;
6 plan tests => 3;
8 test_output("Constant expressions in script block", q[
9 define numeric tx = 42;
10 define numeric ty = 24;
11 define tz() returning numeric { return = 123; }
12 script (tx, ty, tx+ty, tz) { }
13 ], q{
14 SCRP 42 24 66 123
15 ENDM
16 });
18 test_error("Reject non-constant expression in script block", q[
19 define tx() returning numeric { return = norn.x; }
20 script (tx, 1, 1, 1) { }
21 ], "constant value expected");
23 test_error("Reject side-effecting expression in script block", q[
24 define tx() returning numeric { print(42); return = 42; }
25 script(tx, 1, 1, 1) { }
26 ], "side-effects not allowed");