Browse Source

* runtime check

peter 22 years ago
parent
commit
3e86b4d56e
1 changed files with 24 additions and 4 deletions
  1. 24 4
      tests/tbs/tb0438.pp

+ 24 - 4
tests/tbs/tb0438.pp

@@ -1,13 +1,33 @@
-{ %version=1.1 }
-{$mode objfpc}
-procedure p(a : array of const);
+{$ifdef fpc}{$mode objfpc}{$endif}
 
+procedure p(a : array of const);
+  var
+    i : integer;
   begin
+    for i:=low(a) to high(a) do
+     begin
+       write(i,': ');
+       if (a[i].vtype=vtpchar) then
+        begin
+          writeln('"',a[i].vpchar,'"');
+          if (a[i].vpchar<>'test') then
+           begin
+             writeln('Wrong string content');
+             halt(1);
+           end;
+        end
+       else
+        begin
+          writeln('No string type (',a[i].vtype,')');
+          halt(1);
+        end;
+     end;
   end;
 
 var
    a : array[0..25] of char;
 
 begin
-   p([a]);
+   a:='test';
+   p([a,a]);
 end.