A new version of NetworkTests was added to project The Inbox:
http://source.squeak.org/inbox/NetworkTests-tonyg.44.mcz ==================== Summary ==================== Name: NetworkTests-tonyg.44 Author: tonyg Time: 19 February 2017, 11:58:49.983661 am UUID: 1828cc1e-30e3-42f8-9161-e41bb29579a6 Ancestors: NetworkTests-mt.43 Add tests for SocketStream>>upToAll: with varying delimiter lengths, in binary mode in particular. As of Network-tfel.185, ascii mode works fine because ('abc' indexOfSubCollection: 'b' startingAt: -999) is acceptable, but binary mode doesn't work because out-of-range start positions are rejected there. =============== Diff against NetworkTests-mt.43 =============== Item was added: + ----- Method: SocketStreamTest>>testUpToAllCrlfAscii (in category 'stream protocol') ----- + testUpToAllCrlfAscii + "Tests correct behavior of #upToAll with a two-byte delimiter in ascii mode" + self testUpToAllDelimiter: String crlf + input: 'A header', String crlf, 'and a body' + expected: {'A header'. 'and a body'} + binary: false. + ! Item was added: + ----- Method: SocketStreamTest>>testUpToAllCrlfBinary (in category 'stream protocol') ----- + testUpToAllCrlfBinary + "Tests correct behavior of #upToAll with a two-byte delimiter in binary mode" + self testUpToAllDelimiter: String crlf + input: 'A header', String crlf, 'and a body' + expected: {'A header'. 'and a body'} + binary: true. + ! Item was added: + ----- Method: SocketStreamTest>>testUpToAllCrlfCrlfAscii (in category 'stream protocol') ----- + testUpToAllCrlfCrlfAscii + "Tests correct behavior of #upToAll with a four-byte delimiter in ascii mode" + self testUpToAllDelimiter: String crlfcrlf + input: 'A header', String crlfcrlf, 'and a body' + expected: {'A header'. 'and a body'} + binary: false. + ! Item was added: + ----- Method: SocketStreamTest>>testUpToAllCrlfCrlfBinary (in category 'stream protocol') ----- + testUpToAllCrlfCrlfBinary + "Tests correct behavior of #upToAll with a four-byte delimiter in binary mode" + self testUpToAllDelimiter: String crlfcrlf + input: 'A header', String crlfcrlf, 'and a body' + expected: {'A header'. 'and a body'} + binary: true. + ! Item was added: + ----- Method: SocketStreamTest>>testUpToAllDelimiter:input:expected:binary: (in category 'stream protocol') ----- + testUpToAllDelimiter: delimiter input: input expected: aCollection binary: useBinary + "General test of #upToAll." + clientStream nextPutAll: input; close. + serverStream shouldSignal: false. + useBinary ifTrue: [serverStream binary] ifFalse: [serverStream ascii]. + aCollection do: [:expected | | actual | + actual := (serverStream upToAll: delimiter) asString. + self assert: actual = expected]. + ! Item was added: + ----- Method: SocketStreamTest>>testUpToAllEmptyPatternAscii (in category 'stream protocol') ----- + testUpToAllEmptyPatternAscii + "Tests correct behavior of #upToAll with an empty delimiter string, in ascii mode" + self testUpToAllDelimiter: '' + input: 'xaxbxc' + expected: {'xaxbxc'} + binary: false. + ! Item was added: + ----- Method: SocketStreamTest>>testUpToAllEmptyPatternBinary (in category 'stream protocol') ----- + testUpToAllEmptyPatternBinary + "Tests correct behavior of #upToAll with an empty delimiter string, in binary mode" + self testUpToAllDelimiter: '' + input: 'xaxbxc' + expected: {'xaxbxc'} + binary: true. + ! Item was added: + ----- Method: SocketStreamTest>>testUpToAllLongPatternAscii (in category 'stream protocol') ----- + testUpToAllLongPatternAscii + "Tests correct behavior of #upToAll with a long delimiter string, in ascii mode" + self testUpToAllDelimiter: 'xxxxx' + input: 'xxxxxaxxxxbxxxxxc' + expected: {''. 'axxxxb'. 'c'} + binary: false. + ! Item was added: + ----- Method: SocketStreamTest>>testUpToAllLongPatternBinary (in category 'stream protocol') ----- + testUpToAllLongPatternBinary + "Tests correct behavior of #upToAll with a long delimiter string, in binary mode" + self testUpToAllDelimiter: 'xxxxx' + input: 'xxxxxaxxxxbxxxxxc' + expected: {''. 'axxxxb'. 'c'} + binary: true. + ! Item was added: + ----- Method: SocketStreamTest>>testUpToAllMediumPatternAscii (in category 'stream protocol') ----- + testUpToAllMediumPatternAscii + "Tests correct behavior of #upToAll with a two-character delimiter string, in ascii mode" + self testUpToAllDelimiter: 'xx' + input: 'xxaxbxxc' + expected: {''. 'axb'. 'c'} + binary: false. + ! Item was added: + ----- Method: SocketStreamTest>>testUpToAllMediumPatternBinary (in category 'stream protocol') ----- + testUpToAllMediumPatternBinary + "Tests correct behavior of #upToAll with a two-character delimiter string, in binary mode" + self testUpToAllDelimiter: 'xx' + input: 'xxaxbxxc' + expected: {''. 'axb'. 'c'} + binary: true. + ! Item was added: + ----- Method: SocketStreamTest>>testUpToAllShortPatternAscii (in category 'stream protocol') ----- + testUpToAllShortPatternAscii + "Tests correct behavior of #upToAll with a short delimiter string, in ascii mode" + self testUpToAllDelimiter: 'x' + input: 'xaxbxc' + expected: {''. 'a'. 'b'. 'c'} + binary: false. + ! Item was added: + ----- Method: SocketStreamTest>>testUpToAllShortPatternAscii2 (in category 'stream protocol') ----- + testUpToAllShortPatternAscii2 + "Tests correct behavior of #upToAll with a short delimiter string, in ascii mode" + self testUpToAllDelimiter: 'x' + input: 'axbxcx' + expected: {'a'. 'b'. 'c'. ''} + binary: false. + ! Item was added: + ----- Method: SocketStreamTest>>testUpToAllShortPatternBinary (in category 'stream protocol') ----- + testUpToAllShortPatternBinary + "Tests correct behavior of #upToAll with a short delimiter string, in binary mode" + self testUpToAllDelimiter: 'x' + input: 'xaxbxc' + expected: {''. 'a'. 'b'. 'c'} + binary: true. + ! Item was added: + ----- Method: SocketStreamTest>>testUpToAllShortPatternBinary2 (in category 'stream protocol') ----- + testUpToAllShortPatternBinary2 + "Tests correct behavior of #upToAll with a short delimiter string, in binary mode" + self testUpToAllDelimiter: 'x' + input: 'axbxcx' + expected: {'a'. 'b'. 'c'. ''} + binary: true. + ! |
Free forum by Nabble | Edit this page |