The Trunk: NetworkTests-ar.16.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: NetworkTests-ar.16.mcz

commits-2
Andreas Raab uploaded a new version of NetworkTests to project The Trunk:
http://source.squeak.org/trunk/NetworkTests-ar.16.mcz

==================== Summary ====================

Name: NetworkTests-ar.16
Author: ar
Time: 2 August 2010, 7:05:25.718 pm
UUID: 533aff87-dfb6-f648-9a3a-6ca6065deff1
Ancestors: NetworkTests-topa.15

Add tests for SocketStream #upTo: and #upToAll:.

=============== Diff against NetworkTests-topa.15 ===============

Item was added:
+ ----- Method: SocketStreamTest>>testUpToAllAfterCloseSignaling (in category 'stream protocol') -----
+ testUpToAllAfterCloseSignaling
+ "Tests correct behavior of #upToAll"
+
+ clientStream nextPutAll:'A line of text'.
+ clientStream close.
+ self should: [serverStream upToAll: String crlf] raise: ConnectionClosed.
+ !

Item was added:
+ ----- Method: SocketStreamTest>>testUpToAllLimit (in category 'stream protocol') -----
+ testUpToAllLimit
+ "Tests correct behavior of #upToAll:limit:"
+
+ clientStream nextPutAll:'A line of text'; flush.
+ self assert: (serverStream upToAll: String crlf limit: 5) = 'A line of text'.!

Item was added:
+ ----- Method: SocketStreamTest>>tearDown (in category 'setup') -----
+ tearDown
+ clientStream ifNotNil:[clientStream destroy].
+ serverStream ifNotNil:[serverStream destroy].!

Item was added:
+ ----- Method: SocketStreamTest>>testUpToAllTimeout (in category 'stream protocol') -----
+ testUpToAllTimeout
+ "Tests correct behavior of #upToAll"
+
+ clientStream nextPutAll: 'A line of text'.
+ serverStream timeout: 1.
+ self should: [serverStream upToAll: String crlf] raise: ConnectionTimedOut.
+ !

Item was added:
+ ----- Method: SocketStreamTest>>testUpToTimeout (in category 'stream protocol') -----
+ testUpToTimeout
+ "Tests correct behavior of #upToAll"
+
+ clientStream nextPutAll: 'A line of text'.
+ serverStream timeout: 1.
+ self should: [serverStream upTo: Character cr] raise: ConnectionTimedOut.
+ !

Item was added:
+ ----- Method: SocketStreamTest>>setUp (in category 'setup') -----
+ setUp
+ | listener clientSocket serverSocket |
+ listener := Socket newTCP.
+ [listener listenOn: 0 backlogSize: 4.
+
+ clientSocket := Socket newTCP.
+ clientSocket connectTo: #[127 0 0 1] port: listener localPort.
+ clientSocket waitForConnectionFor: 1.
+ self assert: clientSocket isConnected.
+
+ serverSocket := listener waitForAcceptFor: 1.
+ self assert: serverSocket isConnected.
+ ] ensure:[listener destroy].
+
+ clientStream := SocketStream on: clientSocket.
+ serverStream := SocketStream on: serverSocket.
+ !

Item was added:
+ ----- Method: SocketStreamTest>>testUpToAfterCloseNonSignaling (in category 'stream protocol') -----
+ testUpToAfterCloseNonSignaling
+ "Tests correct behavior of #upToAll"
+
+ | resp |
+ clientStream nextPutAll: 'A line of text'.
+ clientStream close.
+ serverStream shouldSignal: false.
+ self shouldnt: [resp := serverStream upTo: Character cr] raise: ConnectionClosed.
+ self assert: resp = 'A line of text'.!

Item was added:
+ ----- Method: SocketStreamTest>>testUpToAfterCloseSignaling (in category 'stream protocol') -----
+ testUpToAfterCloseSignaling
+ "Tests correct behavior of #upToAll"
+
+ clientStream nextPutAll:'A line of text'.
+ clientStream close.
+ self should: [serverStream upTo: Character cr] raise: ConnectionClosed.
+ !

Item was added:
+ ClassTestCase subclass: #SocketStreamTest
+ instanceVariableNames: 'clientStream serverStream'
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'NetworkTests-Kernel'!

Item was added:
+ ----- Method: SocketStreamTest>>testUpToMax (in category 'stream protocol') -----
+ testUpToMax
+ "Tests correct behavior of #upToAll:max:"
+
+ clientStream nextPutAll:'A line of text'; flush.
+ self assert: (serverStream upTo: Character cr limit: 5) = 'A line of text'.!

Item was added:
+ ----- Method: SocketStreamTest>>testUpToAll (in category 'stream protocol') -----
+ testUpToAll
+ "Tests correct behavior of #upToAll"
+
+ clientStream nextPutAll:'A line of text', String crlf, 'with more text'; flush.
+ self assert: (serverStream upToAll: String crlf) = 'A line of text'.
+ [(Delay forSeconds: 1) wait.
+ clientStream nextPutAll: String crlf; flush] fork.
+ self assert: (serverStream upToAll: String crlf) = 'with more text'.
+ !

Item was added:
+ ----- Method: SocketStreamTest>>testUpToAllAfterCloseNonSignaling (in category 'stream protocol') -----
+ testUpToAllAfterCloseNonSignaling
+ "Tests correct behavior of #upToAll"
+
+ | resp |
+ clientStream nextPutAll: 'A line of text'.
+ clientStream close.
+ serverStream shouldSignal: false.
+ self shouldnt: [resp := serverStream upToAll: String crlf] raise: ConnectionClosed.
+ self assert: resp = 'A line of text'.!

Item was added:
+ ----- Method: SocketStreamTest>>testUpTo (in category 'stream protocol') -----
+ testUpTo
+ "Tests correct behavior of #upTo:"
+
+ clientStream nextPutAll:'A line of text', String cr, 'with more text'; flush.
+ self assert: (serverStream upTo: Character cr) = 'A line of text'.
+ [(Delay forSeconds: 1) wait.
+ clientStream nextPutAll: String cr; flush] fork.
+ self assert: (serverStream upTo: Character cr) = 'with more text'.
+ !