--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/RegressionTests__OperatingSystemTest.st Wed Jul 10 11:22:43 2002 +0200
@@ -0,0 +1,99 @@
+"{ Package: 'exept:regression' }"
+
+"{ NameSpace: RegressionTests }"
+
+TestCase subclass:#OperatingSystemTest
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Tests-Regression'
+!
+
+
+!OperatingSystemTest methodsFor:'release'!
+
+tearDown
+ '/tmp/lsOut' asFilename delete.
+! !
+
+!OperatingSystemTest methodsFor:'tests'!
+
+testCommandOutput1
+ |expected outStr errStr exitStatus|
+
+ OperatingSystem executeCommand:'ls > /tmp/lsOut'.
+ expected := '/tmp/lsOut' asFilename contentsOfEntireFile.
+
+ 50 timesRepeat:[
+ outStr := '' writeStream.
+ errStr := '' writeStream.
+ OperatingSystem
+ executeCommand:'ls'
+ inputFrom:nil
+ outputTo:outStr
+ errorTo:errStr
+ onError:[:status | exitStatus := status].
+ self assert:(outStr contents = expected).
+ self assert:(errStr contents isEmpty).
+ self assert:(exitStatus isNil).
+ ].
+
+
+ "
+ self new testCommandOutput1
+ "
+!
+
+testCommandOutput2
+ |outStr errStr exitStatus|
+
+ 50 timesRepeat:[
+ outStr := '' writeStream.
+ errStr := '' writeStream.
+ OperatingSystem
+ executeCommand:'ls /fooBar'
+ inputFrom:nil
+ outputTo:outStr
+ errorTo:errStr
+ onError:[:status | exitStatus := status].
+ self assert:(outStr contents isEmpty).
+ self assert:(errStr contents notEmpty).
+ self assert:(exitStatus success not).
+ self assert:(exitStatus stillAlive not).
+ self assert:(exitStatus couldNotExecute not).
+ ].
+
+ "
+ self new testCommandOutput2
+ "
+!
+
+testInvalidCommand
+ |outStr errStr exitStatus|
+
+ 50 timesRepeat:[
+ outStr := '' writeStream.
+ errStr := '' writeStream.
+ OperatingSystem
+ executeCommand:'blabla /fooBar'
+ inputFrom:nil
+ outputTo:outStr
+ errorTo:errStr
+ onError:[:status | exitStatus := status].
+ self assert:(exitStatus success not).
+ self assert:(exitStatus stillAlive not).
+ self assert:(exitStatus couldNotExecute).
+ self assert:(outStr contents isEmpty).
+ self assert:(errStr contents notEmpty).
+ ].
+
+ "
+ self new testInvalidCommand
+ "
+! !
+
+!OperatingSystemTest class methodsFor:'documentation'!
+
+version
+ ^ '$Header$'
+! !