RegressionTests__OperatingSystemTest.st
changeset 2224 b00d766d6c9d
parent 2160 f2b59e219ee5
equal deleted inserted replaced
2223:9368892ee1a7 2224:b00d766d6c9d
       
     1 "{ Encoding: utf8 }"
       
     2 
     1 "{ Package: 'stx:goodies/regression' }"
     3 "{ Package: 'stx:goodies/regression' }"
     2 
     4 
     3 "{ NameSpace: RegressionTests }"
     5 "{ NameSpace: RegressionTests }"
     4 
     6 
     5 TestCase subclass:#OperatingSystemTest
     7 TestCase subclass:#OperatingSystemTest
    36         ^ self
    38         ^ self
    37     ].
    39     ].
    38 
    40 
    39     targetFile := self targetFile.
    41     targetFile := self targetFile.
    40 
    42 
    41     OperatingSystem executeCommand:aCommand, ' > ', targetFile pathName.
    43     OperatingSystem executeCommand:aCommand, ' > "', targetFile pathName, '"'.
    42     expected := targetFile contentsOfEntireFile.
    44     expected := targetFile contentsOfEntireFile.
    43 
    45 
    44     outStr := ActorStream new.
    46     outStr := ActorStream new.
    45     outStr nextPutLineBlock:[:line | Transcript normal; showCR:line ].
    47     outStr nextPutLineBlock:[:line | Transcript normal; showCR:line ].
    46     errStr := ActorStream new.
    48     errStr := ActorStream new.
    52         outputTo:outStr
    54         outputTo:outStr
    53         errorTo:errStr
    55         errorTo:errStr
    54         inDirectory:nil
    56         inDirectory:nil
    55         lineWise:true
    57         lineWise:true
    56         onError:[:status | exitStatus := status].
    58         onError:[:status | exitStatus := status].
       
    59 
       
    60     "Modified: / 02-05-2019 / 13:42:28 / Stefan Reise"
    57 !
    61 !
    58 
    62 
    59 helperCommandOutput1WithCommand:aCommand
    63 helperCommandOutput1WithCommand:aCommand
    60     |targetFile expected outStr errStr exitStatus|
    64     |targetFile expected outStr errStr exitStatus|
    61 
    65 
    62     targetFile := self targetFile.
    66     targetFile := self targetFile.
    63 
    67 
    64     OperatingSystem executeCommand:aCommand, ' > ', targetFile pathName.
    68     OperatingSystem executeCommand:aCommand, ' > "', targetFile pathName, '"'.
    65     expected := targetFile contentsOfEntireFile.
    69     expected := targetFile contentsOfEntireFile.
    66 
    70 
    67     1 to:50 do:[:counter |
    71     1 to:50 do:[:counter |
    68 "/ Transcript show:counter; showCR:':'.
    72 "/ Transcript show:counter; showCR:':'.
    69         outStr := '' writeStream.
    73         outStr := '' writeStream.
    76             onError:[:status | exitStatus := status].
    80             onError:[:status | exitStatus := status].
    77         self assert:(outStr contents = expected).
    81         self assert:(outStr contents = expected).
    78         self assert:(errStr contents isEmpty).
    82         self assert:(errStr contents isEmpty).
    79         self assert:(exitStatus isNil).
    83         self assert:(exitStatus isNil).
    80     ].
    84     ].
       
    85 
       
    86     "Modified: / 02-05-2019 / 13:42:44 / Stefan Reise"
    81 !
    87 !
    82 
    88 
    83 helperCommandOutput2WithCommand:aCommand
    89 helperCommandOutput2WithCommand:aCommand
    84     |outStr errStr exitStatus|
    90     |outStr errStr exitStatus|
    85 
    91