rev 171 - trunk/pr

SVN User <[email protected]>
Newsgroups gmane.comp.lang.prothon.cvs
Message-ID <[email protected]>
Author: bcollins
Date: 2004-03-28 00:56:37 -0500 (Sun, 28 Mar 2004)
New Revision: 171

Modified:
   trunk/pr/file_test.pr
Log:
Make file executable and import File explicitly. Also set svn:eol-style so
we can share this with proper newlines.


Modified: trunk/pr/file_test.pr
===================================================================
--- trunk/pr/file_test.pr	2004-03-28 05:46:41 UTC (rev 170)
+++ trunk/pr/file_test.pr	2004-03-28 05:56:37 UTC (rev 171)
@@ -1,41 +1,42 @@
-
-# file_test.pr
-
-f = File("test.txt", 'w')
-for i in 5:
-	f.write("line "+i+'\n')
-f.writelines( ['line 5\n','line 6\n','line 7\n','line 8\n','line 9\n',])
-f.close()
-
-ref =  ['line 0\n','line 1\n','line 2\n','line 3\n','line 4\n',]
-ref += ['line 5\n','line 6\n','line 7\n','line 8\n','line 9\n',]
-
-f = File("test.txt")
-x = f.read()
-print x
-if (x != ''.join(ref)): 
-	print "test failed: x != f"
-	Sys.exit(1)
-
-f.seek(7)
-x = f.read(7)
-print x
-if (x != 'line 1\n'): 
-	print "test failed: x != 'line 1'"
-	Sys.exit(1)
-
-f.seek(21)
-x = f.read(14)
-print x
-if (x != 'line 3\nline 4\n'): 
-	print "test failed: x != 'line 3line 4'"
-	Sys.exit(1)
-
-x = f.readlines()
-ref = ['line 5\n','line 6\n','line 7\n','line 8\n','line 9\n',]
-print x
-if (''.join(x) != ''.join(ref)): 
-	print "test failed: x != 'line 5','line 6','line 7','line 8','line 9'"
-	Sys.exit(1)
-
-print "\nall tests passed"
\ No newline at end of file
+#!/usr/local/bin/prothon
+
+import File
+
+f = File("test.txt", 'w+')
+for i in 5:
+	f.write("line "+i+'\n')
+f.writelines( ['line 5\n','line 6\n','line 7\n','line 8\n','line 9\n',])
+f.close()
+
+ref =  ['line 0\n','line 1\n','line 2\n','line 3\n','line 4\n',]
+ref += ['line 5\n','line 6\n','line 7\n','line 8\n','line 9\n',]
+
+f = File("test.txt")
+x = f.read()
+print x
+if (x != ''.join(ref)): 
+	print "test failed: x != f"
+	Sys.exit(1)
+
+f.seek(7)
+x = f.read(7)
+print x
+if (x != 'line 1\n'): 
+	print "test failed: x != 'line 1'"
+	Sys.exit(1)
+
+f.seek(21)
+x = f.read(14)
+print x
+if (x != 'line 3\nline 4\n'): 
+	print "test failed: x != 'line 3line 4'"
+	Sys.exit(1)
+
+x = f.readlines()
+ref = ['line 5\n','line 6\n','line 7\n','line 8\n','line 9\n',]
+print x
+if (''.join(x) != ''.join(ref)): 
+	print "test failed: x != 'line 5','line 6','line 7','line 8','line 9'"
+	Sys.exit(1)
+
+print "\nall tests passed"


Property changes on: trunk/pr/file_test.pr
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:eol-style
   + native
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.