summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorNagi5Yeq <wu@x-nagi.com>2020-05-30 00:25:03 +0800
committerNagi5Yeq <wu@x-nagi.com>2020-05-30 00:25:03 +0800
commit56d68765016fc7aa68fe7b522de5e84c7a12123a (patch)
treeba9828637913aa40bc1b1509c5127be9bded3a6e /t
parentf15a071f6d599d2a21083dfb041b18db8d482949 (diff)
global variable, constant support
Diffstat (limited to 't')
-rw-r--r--t/trivial.pas33
1 files changed, 33 insertions, 0 deletions
diff --git a/t/trivial.pas b/t/trivial.pas
index e515745..c537cf1 100644
--- a/t/trivial.pas
+++ b/t/trivial.pas
@@ -1,4 +1,12 @@
program a;
+const
+ gb=true;
+ gc='a';
+ gi=5;
+ gr=3.1415;
+ gs='nagi';
+var
+ gv:integer;
function arithmetic_test(a:integer;b:char;c:real):integer;
var
@@ -81,3 +89,28 @@ begin
until b>5;
branch_test:=a;
end;
+
+function name_test_global():integer;
+begin
+ gv:=1;
+ name_test_global:=gv+gb+gc+gi+gr+gs[3];
+end;
+
+function name_test_local():integer;
+const
+ gb=false;
+ gc='A';
+ gi=10;
+ gr=2.71828;
+ gs='Hanjie Wu';
+var
+ gv:integer;
+begin
+ gv:=0;
+ name_test_local:=gv+gb+gc+gi+gr+gs[3];
+end;
+
+function name_test():boolean;
+begin
+ name_test:=name_test_global()<>name_test_local()
+end;