RegressionTests__FileStreamTest.st
changeset 119 11246c09ec93
parent 118 2618cf1cd493
child 120 01f2cb81dc38
--- a/RegressionTests__FileStreamTest.st	Tue Dec 11 16:19:34 2001 +0100
+++ b/RegressionTests__FileStreamTest.st	Tue Dec 11 16:31:26 2001 +0100
@@ -20,17 +20,17 @@
     f := 'testFile' asFilename writeStream binary.
     bytes := ByteArray new:1024.
     1 to:bytes size do:[:i |
-	bytes at:i put:(i \\ 256).
+        bytes at:i put:(i \\ 256).
     ].
 
     100 timesRepeat:[
-	f nextPutAll:bytes.
+        f nextPutAll:bytes.
     ].
 
     f close.
 
     "
-     self createTestFile
+     self new createTestFile
     "
 
     "Created: / 12.8.1998 / 13:25:25 / cg"
@@ -58,24 +58,10 @@
     "Modified: / 12.8.1998 / 13:36:40 / cg"
 !
 
-runAllTests
-    self testRead1.
-    self testRead2.
-    self testRead3.
-    self testReadCheckPipe4.
-    self testReadCheckPipe5.
-    self testReadPipe6.
-    self testReadPipe7.
-
-    "
-     self runAllTests
-    "
-!
-
 testAppend1
     "basic open for appending."
 
-    |file s sz|
+    |file s sz actualContents expectedContents|
 
     file := Filename newTemporary.
     s := file writeStream.
@@ -84,7 +70,7 @@
     s close.
 
     sz := file fileSize.
-    sz ~= 100 ifTrue:[self error:'size mismatch'].
+    self should:[ sz = 100 ]. "/ size mismatch
 
     s := file appendingWriteStream.
     s binary.
@@ -92,16 +78,16 @@
     s close.
 
     sz := file fileSize.
-    sz ~= 200 ifTrue:[self error:'size mismatch'].
+    self should:[ sz = 200 ]. "/ size mismatch
 
-    (file binaryContentsOfEntireFile ~= (1 to:200) asByteArray) ifTrue:[
-        self error:'contents mismatch'
-    ].
+    actualContents := file binaryContentsOfEntireFile.
+    expectedContents := (1 to:200) asByteArray.
+    self should:[ (actualContents = expectedContents) ].   "/ contents mismatch
 
     file delete.
 
     "
-     self testAppend1
+     self new testAppend1
     "
 !
 
@@ -117,7 +103,7 @@
     self readFileExpecting:sz.
 
     "
-     self testOpenRead1
+     self new testOpenRead1
     "
 !
 
@@ -133,7 +119,7 @@
     self readFileExpecting:sz.
 
     "
-     self test1
+     self new testRead1
     "
 
     "Modified: / 12.8.1998 / 13:29:55 / cg"
@@ -154,7 +140,7 @@
     ].
 
     "
-     self test2
+     self new testRead2
     "
 
     "Modified: / 12.8.1998 / 13:30:55 / cg"
@@ -187,7 +173,7 @@
         expandMacrosWith:nLoop with:count) printCR
 
     "
-     self test3
+     self new testRead3
     "
 
     "Modified: / 12.8.1998 / 13:42:13 / cg"
@@ -197,7 +183,7 @@
     "readCheck a pipe.
      Do this and interrupt the reading thread heavily"
 
-    |sz s p count nLoop|
+    | s p count nLoop|
 
     nLoop := 1000.
 
@@ -220,7 +206,7 @@
     s close.
 
     "
-     self test4
+     self new testReadCheckPipe4
     "
 
     "Modified: / 12.8.1998 / 13:42:13 / cg"
@@ -230,7 +216,7 @@
     "readCheck a pipe.
      Do this and interrupt the reading thread heavily"
 
-    |sz s p count nLoop|
+    | s p count nLoop|
 
     nLoop := 1000.
 
@@ -253,7 +239,7 @@
     s close.
 
     "
-     self test5
+     self new testReadCheckPipe5
     "
 
     "Modified: / 12.8.1998 / 13:42:13 / cg"
@@ -263,7 +249,7 @@
     "read a pipe.
      Do this and interrupt the reading thread heavily"
 
-    |sz s p count nLoop|
+    | s p count nLoop|
 
     nLoop := 1000.
 
@@ -285,7 +271,7 @@
     s close.
 
     "
-     self test6
+     self new testReadPipe6
     "
 
     "Modified: / 12.8.1998 / 13:42:13 / cg"