Browse Source

+ tests to check if filename exists

pierre 27 years ago
parent
commit
49c698a41b
3 changed files with 30 additions and 8 deletions
  1. 1 0
      tests/README
  2. 23 7
      tests/getret.pp
  3. 6 1
      tests/makefile

+ 1 - 0
tests/README

@@ -24,6 +24,7 @@ ts010004.pp       tests forward classes
 ts010005.pp       tests method overriding
 ts010006.pp       tests libraries
 ts010015.pp       tests typed files.
+ts010016.pp       tests conversion of smallsets in normsets in consts 
 
 ts10100.pp        tests for delphi object model
 -

+ 23 - 7
tests/getret.pp

@@ -10,6 +10,7 @@ program getret;
       filename,firstline : string;
       i : byte;	
       ppfile, retfile : text;	
+      exefile : file;
 
 begin
   assign(retfile,'retcode');
@@ -21,13 +22,18 @@ begin
        if pos('.',filename)=0 then
          filename:=filename+'.pp';
        assign(ppfile,filename);
+{$I-}
        reset(ppfile);
-       readln(ppfile,firstline);
-       if pos('$OPT=',firstline)>0 then
-         args:=copy(Firstline,pos('=',Firstline)+1,255);
-       if pos('}',args)>0 then
-         args:=copy(args,1,pos('}',args)-1);	
-       close(ppfile);
+       if ioresult=0 then
+         begin
+{$I+}
+            readln(ppfile,firstline);
+            if pos('$OPT=',firstline)>0 then
+              args:=copy(Firstline,pos('=',Firstline)+1,255);
+            if pos('}',args)>0 then
+            args:=copy(args,1,pos('}',args)-1);	
+            close(ppfile);
+         end;
     end;			
   for i:=2 to paramcount do
     args:=args+' '+paramstr(i);
@@ -37,7 +43,17 @@ begin
     com:=com+'.exe';
 {$endif not linux}
 
-  com:=fsearch(com,getenv('PATH'));
+  assign(exefile,com);
+{$I-}
+  Writeln('testing ',com);
+  reset(exefile,1);
+  if ioresult<>0 then
+    begin
+       com:=fsearch(com,getenv('PATH'));
+    end
+  else
+    close(exefile);
+{$I+}
   Writeln('Executing "',com,' ',args,'"');
   Flush(output);
   swapvectors;

+ 6 - 1
tests/makefile

@@ -62,6 +62,8 @@ endif
 	
 ifndef PP
 PP=ppc386
+else
+export PP
 endif
 
 ifndef OPT
@@ -104,7 +106,10 @@ clean :
 	-rm *.re* *.o *.ppu ts*.exe tf*.exe log faillist
 
 # $Log$
-# Revision 1.4  1998-10-21 12:14:30  pierre
+# Revision 1.5  1998-10-21 16:24:16  pierre
+#  + tests to check if filename exists
+#
+# Revision 1.4  1998/10/21 12:14:30  pierre
 #  * stupid error removing getret.exe each time
 #
 # Revision 1.3  1998/10/21 12:12:09  pierre