[squeak-dev] The Trunk: NetworkTests-pre.56.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu May 2 13:06:59 UTC 2019
Patrick Rein uploaded a new version of NetworkTests to project The Trunk:
http://source.squeak.org/trunk/NetworkTests-pre.56.mcz
==================== Summary ====================
Name: NetworkTests-pre.56
Author: pre
Time: 2 May 2019, 3:06:57.095906 pm
UUID: 8dd29edd-d8bf-3e48-a545-24d210b58774
Ancestors: NetworkTests-pre.55
Recategorizes some test methods and expected failure methods.
=============== Diff against NetworkTests-pre.55 ===============
Item was changed:
+ ----- Method: FileUrlTest>>testAsString (in category 'tests') -----
- ----- Method: FileUrlTest>>testAsString (in category 'testing') -----
testAsString
| target url |
target := 'file://localhost/etc/rc.conf'.
url := target asUrl.
self assert: url asString = target.
!
Item was changed:
+ ----- Method: GenericUrlTest>>testAsString (in category 'tests') -----
- ----- Method: GenericUrlTest>>testAsString (in category 'testing') -----
testAsString
| url |
url := GenericUrl new schemeName: 'sip' locator: 'foo at bar'.
self assert: url asString = 'sip:foo at bar'.!
Item was changed:
+ ----- Method: HierarchicalUrlTest>>testAsString (in category 'tests') -----
- ----- Method: HierarchicalUrlTest>>testAsString (in category 'testing') -----
testAsString
| url |
url := HierarchicalUrl new
schemeName: 'ftp'
authority: 'localhost'
path: #('path' 'to' 'file')
query: 'aQuery'.
self assert: url asString = 'ftp://localhost/path/to/file?aQuery'.!
Item was changed:
+ ----- Method: HttpUrlTest>>testHttps (in category 'tests') -----
- ----- Method: HttpUrlTest>>testHttps (in category 'as yet unclassified') -----
testHttps
self assert: 'https://encrypted.google.com' asUrl class == HttpUrl!
Item was changed:
+ ----- Method: MIMEDocumentTest>>testUtf8Text (in category 'tests') -----
- ----- Method: MIMEDocumentTest>>testUtf8Text (in category 'as yet unclassified') -----
testUtf8Text
| document |
document := MIMEDocument contentType: 'text/plain; charset="utf8"' content: self utf8String.
self assert: self utf8String utf8ToSqueak equals: document content !
Item was changed:
+ ----- Method: MIMEDocumentTest>>utf8String (in category 'fixtures') -----
- ----- Method: MIMEDocumentTest>>utf8String (in category 'as yet unclassified') -----
utf8String
^ #[199 161 84 83 67 72] asString!
Item was changed:
+ ----- Method: MailDateAndTimeTest>>testBasicDate (in category 'tests') -----
- ----- Method: MailDateAndTimeTest>>testBasicDate (in category 'as yet unclassified') -----
testBasicDate
| date |
date := DateAndTime year: 2017 month: 2 day: 3 hour: 0 minute: 0 second: 0 offset: (Duration hours: 0).
self assert: 'Fri, 03 Feb 2017 00:00:00 +0000' equals: date asMailMessageString!
Item was changed:
+ ----- Method: MailDateAndTimeTest>>testBasicDateAndTime (in category 'tests') -----
- ----- Method: MailDateAndTimeTest>>testBasicDateAndTime (in category 'as yet unclassified') -----
testBasicDateAndTime
| date |
date := DateAndTime year: 2000 month: 6 day: 22 hour: 14 minute: 17 second: 47 offset: (Duration days: 0 hours: -5 minutes: 0 seconds: 0 nanoSeconds:0).
self assert: 'Thu, 22 Jun 2000 14:17:47 -0500' equals: date asMailMessageString
!
Item was changed:
+ ----- Method: MailMessageTest>>testAttachmentsGetTheirOwnContentType (in category 'tests') -----
- ----- Method: MailMessageTest>>testAttachmentsGetTheirOwnContentType (in category 'testing') -----
testAttachmentsGetTheirOwnContentType
| message contentType |
message := MailMessage empty
addAttachmentFrom: 'abcxxx' readStream withName: 'aTestingAttachment.pdf';
body: ((MIMEDocument contentType: 'application/foo' content: 'This is the main text' squeakToUtf8)
charset: 'utf-8'; yourself).
self assert: message attachments size equals: 1.
contentType := (message attachments first fieldNamed: 'content-type' ifAbsent: [self fail])
mainValue.
self assert: contentType equals: 'application/pdf'.
!
Item was changed:
+ ----- Method: MailMessageTest>>testAttachmentsReturnsTheAttachments (in category 'tests') -----
- ----- Method: MailMessageTest>>testAttachmentsReturnsTheAttachments (in category 'testing') -----
testAttachmentsReturnsTheAttachments
| fileName message |
message := MailMessage empty
addAttachmentFrom: 'abcxxx' readStream withName: 'aTestingAttachment';
body: ((MIMEDocument contentType: 'application/foo' content: 'This is the main text' squeakToUtf8)
charset: 'utf-8'; yourself).
self assert: 1 equals: message attachments size.
fileName := (message attachments first fieldNamed: 'content-disposition' ifAbsent: [self fail])
parameterAt: 'filename' ifAbsent: [''].
self assert: fileName equals: '"aTestingAttachment"'.
fileName := (message attachments first fieldNamed: 'content-type' ifAbsent: [self fail])
parameterAt: 'name' ifAbsent: [''].
self assert: fileName equals: '"aTestingAttachment"'.!
Item was changed:
+ ----- Method: MailMessageTest>>testAttachmentsWorkWithVeryLongFilenames (in category 'tests') -----
- ----- Method: MailMessageTest>>testAttachmentsWorkWithVeryLongFilenames (in category 'testing') -----
testAttachmentsWorkWithVeryLongFilenames
| fileName message |
message := MailMessage empty
addAttachmentFrom: 'abcxxx' readStream withName: 'aTestingAttachmentWithAVeryVeryVeryVeryVeryVeryVeryVeryLongName.file';
body: ((MIMEDocument contentType: 'application/foo' content: 'This is the main text' squeakToUtf8)
charset: 'utf-8'; yourself).
self assert: message attachments size equals: 1.
fileName := (message attachments first fieldNamed: 'content-disposition' ifAbsent: [self fail])
parameterAt: 'filename' ifAbsent: [''].
self assert: '"aTestingAttachmentWithAVeryVeryVeryVeryVeryVeryVeryVeryLongName.file"' equals: fileName
!
Item was changed:
+ ----- Method: MailMessageTest>>testCreateAReplyForFrom (in category 'tests') -----
- ----- Method: MailMessageTest>>testCreateAReplyForFrom (in category 'testing') -----
testCreateAReplyForFrom
| replyMail |
replyMail := MailMessage replyFor: self fixtureMail.
self assert: self fixtureSenderMail equals: replyMail to.!
Item was changed:
+ ----- Method: MailMessageTest>>testCreateAReplyForReplyTo (in category 'tests') -----
- ----- Method: MailMessageTest>>testCreateAReplyForReplyTo (in category 'testing') -----
testCreateAReplyForReplyTo
| replyMail startMail |
startMail := self fixtureMail
setField: 'reply-to' toString: 'anothersender at mail.com';
yourself.
replyMail := MailMessage replyFor: startMail.
self assert: 'anothersender at mail.com' equals: replyMail to.!
Item was changed:
+ ----- Method: MailMessageTest>>testCreateAReplyForReplyTos (in category 'tests') -----
- ----- Method: MailMessageTest>>testCreateAReplyForReplyTos (in category 'testing') -----
testCreateAReplyForReplyTos
| replyMail startMail |
startMail := self fixtureMail
setField: 'reply-to' toString: 'anothersender at mail.com, andanothersender at mail.com';
yourself.
replyMail := MailMessage replyFor: startMail.
self
assert: {'anothersender at mail.com' . 'andanothersender at mail.com'} asSet
equals: ((replyMail to findTokens: ',') collect: [:e | e withBlanksTrimmed]) asSet.!
Item was changed:
+ ----- Method: MailMessageTest>>testCreateAReplyHasANewSubject (in category 'tests') -----
- ----- Method: MailMessageTest>>testCreateAReplyHasANewSubject (in category 'testing') -----
testCreateAReplyHasANewSubject
| replyMail |
replyMail := MailMessage replyFor: self fixtureMail.
self assert: 'Re: ' , self fixtureSubject equals: replyMail subject.!
Item was changed:
+ ----- Method: MailMessageTest>>testCreateMailMessage (in category 'tests') -----
- ----- Method: MailMessageTest>>testCreateMailMessage (in category 'testing') -----
testCreateMailMessage
| newMail |
newMail := MailMessage from: 'From: Al Gore <vicepresident at whitehouse.gov>
To: White House Transportation Coordinator <transport at whitehouse.gov>
Subject: [Map of a country]
there is a country map in this mail somewhere'.
self assert: '[Map of a country]' equals: newMail subject!
Item was changed:
+ ----- Method: MailMessageTest>>testDateAndDateString (in category 'tests') -----
- ----- Method: MailMessageTest>>testDateAndDateString (in category 'testing') -----
testDateAndDateString
| newMail |
newMail := MailMessage from: 'From: Al Gore <vicepresident at whitehouse.gov>
To: White House Transportation Coordinator <transport at whitehouse.gov>
Subject: [Map of a country]
Date: Mon, 12 Aug 2002 17:42:00 +0000
there is a country map in this mail somewhere'.
self assert: (DateAndTime year: 2002 month: 8 day: 12 hour: 17 minute: 42) equals: newMail date.
self assert: '8/12/02' equals: newMail dateString.!
Item was changed:
+ ----- Method: MailMessageTest>>testDateStampFractionalSecondFormatting (in category 'tests') -----
- ----- Method: MailMessageTest>>testDateStampFractionalSecondFormatting (in category 'testing') -----
testDateStampFractionalSecondFormatting
self assert: (MailMessage dateStamp: (DateAndTime fromSeconds: 1.234))
= 'Tue, 1 Jan 1901 00:00:01'
description: 'RFC822 (and RFC2822) forbids non-integer seconds in dates'!
Item was changed:
+ ----- Method: MailMessageTest>>testReplyContainsInReplyTo (in category 'tests') -----
- ----- Method: MailMessageTest>>testReplyContainsInReplyTo (in category 'testing') -----
testReplyContainsInReplyTo
| replyMail |
replyMail := MailMessage replyFor: self fixtureMail.
self assert: self fixtureMessageId equals: (replyMail fieldNamed: 'in-reply-to' ifAbsent: [self fail]) mainValue.!
Item was changed:
+ ----- Method: MailMessageTest>>testReplyContainsReferences (in category 'tests') -----
- ----- Method: MailMessageTest>>testReplyContainsReferences (in category 'testing') -----
testReplyContainsReferences
| replyMail lastReply |
replyMail := MailMessage replyFor: self fixtureMail.
replyMail
setField: 'message-id' toString: 'abc';
from: 'me at mail.com'.
lastReply := MailMessage replyFor: replyMail.
self
assert: self fixtureMessageId , ', abc'
equals: (lastReply fieldNamed: 'references' ifAbsent: [self fail]) mainValue.!
Item was changed:
+ ----- Method: MailMessageTest>>testSendableVersionHasCorrectLineBreaks (in category 'tests') -----
- ----- Method: MailMessageTest>>testSendableVersionHasCorrectLineBreaks (in category 'testing') -----
testSendableVersionHasCorrectLineBreaks
| newMail longContent |
"To create a string which is too long to very old recommendations
of the mail message format, which is about 70 characters."
longContent := ((1 to: 80) do: [:i | i asString]) joinSeparatedBy: ''.
newMail := self fixtureMail.
newMail body: ((MIMEDocument
contentType: MIMEDocument contentTypePlainText
content: longContent)
charset: 'UTF-8';
yourself).
newMail := MailMessage from: newMail asSendableText.
self assert: (newMail bodyTextFormatted asString includesSubstring: longContent)!
Item was changed:
+ ----- Method: SMTPClientTest>>testMailFrom (in category 'tests') -----
- ----- Method: SMTPClientTest>>testMailFrom (in category 'testing') -----
testMailFrom
smtp mailFrom: 'frank at angband.za.org'.
self assert: socket outStream contents = ('MAIL FROM: <frank at angband.za.org>', String crlf).
socket resetOutStream.
smtp mailFrom: '<frank at angband.za.org>'.
self assert: socket outStream contents = ('MAIL FROM: <frank at angband.za.org>', String crlf).
socket resetOutStream.
smtp mailFrom: 'Frank <frank at angband.za.org>'.
self assert: socket outStream contents = ('MAIL FROM: <frank at angband.za.org>', String crlf).!
Item was changed:
+ ----- Method: SocketStreamTest>>setUp (in category 'running') -----
- ----- 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 changed:
+ ----- Method: SocketStreamTest>>tearDown (in category 'running') -----
- ----- Method: SocketStreamTest>>tearDown (in category 'setup') -----
tearDown
clientStream ifNotNil:[clientStream destroy].
serverStream ifNotNil:[serverStream destroy].!
Item was changed:
+ ----- Method: SocketStreamTest>>testNextIntoClose (in category 'tests - stream protocol') -----
- ----- Method: SocketStreamTest>>testNextIntoClose (in category 'stream protocol') -----
testNextIntoClose
"Ensure that #next:into: will function properly when the connection is closed"
clientStream nextPutAll:'A line of text'; flush.
[(Delay forMilliseconds: 100) wait.
clientStream close] fork.
self assert: (serverStream next: 100 into: (String new: 100) startingAt: 1)
equals: 'A line of text'.
!
Item was changed:
+ ----- Method: SocketStreamTest>>testNextIntoCloseNonSignaling (in category 'tests - stream protocol') -----
- ----- Method: SocketStreamTest>>testNextIntoCloseNonSignaling (in category 'stream protocol') -----
testNextIntoCloseNonSignaling
"Ensure that #next:into: will function properly when the connection is closed"
serverStream shouldSignal: false.
clientStream nextPutAll:'A line of text'; flush.
[(Delay forMilliseconds: 100) wait.
clientStream close] fork.
self assert: (serverStream next: 100 into: (String new: 100) startingAt: 1)
equals: 'A line of text'.
!
Item was changed:
+ ----- Method: SocketStreamTest>>testUpTo (in category 'tests - stream protocol') -----
- ----- 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'.
!
Item was changed:
+ ----- Method: SocketStreamTest>>testUpToAfterCloseNonSignaling (in category 'tests - stream protocol') -----
- ----- 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 changed:
+ ----- Method: SocketStreamTest>>testUpToAfterCloseSignaling (in category 'tests - stream protocol') -----
- ----- 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 changed:
+ ----- Method: SocketStreamTest>>testUpToAll (in category 'tests - stream protocol') -----
- ----- 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 changed:
+ ----- Method: SocketStreamTest>>testUpToAllAfterCloseNonSignaling (in category 'tests - stream protocol') -----
- ----- 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 changed:
+ ----- Method: SocketStreamTest>>testUpToAllAfterCloseSignaling (in category 'tests - stream protocol') -----
- ----- 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 changed:
+ ----- Method: SocketStreamTest>>testUpToAllAsciiVsBinary (in category 'tests - stream protocol') -----
- ----- Method: SocketStreamTest>>testUpToAllAsciiVsBinary (in category 'stream protocol') -----
testUpToAllAsciiVsBinary
"Tests correct behavior of #upToAll"
serverStream ascii.
clientStream nextPutAll:'A line of text', String crlf, 'with more text'; flush.
self assert: (serverStream upToAll: #[13 10]) = 'A line of text'.
serverStream binary.
clientStream nextPutAll: String crlf; flush.
self assert: (serverStream upToAll: String crlf) asString = 'with more text'.
!
Item was changed:
+ ----- Method: SocketStreamTest>>testUpToAllCrlfAscii (in category 'tests - stream protocol') -----
- ----- 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 changed:
+ ----- Method: SocketStreamTest>>testUpToAllCrlfBinary (in category 'tests - stream protocol') -----
- ----- 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 changed:
+ ----- Method: SocketStreamTest>>testUpToAllCrlfCrlfAscii (in category 'tests - stream protocol') -----
- ----- 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 changed:
+ ----- Method: SocketStreamTest>>testUpToAllCrlfCrlfBinary (in category 'tests - stream protocol') -----
- ----- 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 changed:
+ ----- Method: SocketStreamTest>>testUpToAllDelimiter:input:expected:binary: (in category 'tests - stream protocol') -----
- ----- 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 changed:
+ ----- Method: SocketStreamTest>>testUpToAllEmptyPatternAscii (in category 'tests - stream protocol') -----
- ----- 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 changed:
+ ----- Method: SocketStreamTest>>testUpToAllEmptyPatternBinary (in category 'tests - stream protocol') -----
- ----- 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 changed:
+ ----- Method: SocketStreamTest>>testUpToAllLimit (in category 'tests - stream protocol') -----
- ----- 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 changed:
+ ----- Method: SocketStreamTest>>testUpToAllLongPatternAscii (in category 'tests - stream protocol') -----
- ----- 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 changed:
+ ----- Method: SocketStreamTest>>testUpToAllLongPatternBinary (in category 'tests - stream protocol') -----
- ----- 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 changed:
+ ----- Method: SocketStreamTest>>testUpToAllMediumPatternAscii (in category 'tests - stream protocol') -----
- ----- 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 changed:
+ ----- Method: SocketStreamTest>>testUpToAllMediumPatternBinary (in category 'tests - stream protocol') -----
- ----- 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 changed:
+ ----- Method: SocketStreamTest>>testUpToAllShortPatternAscii (in category 'tests - stream protocol') -----
- ----- 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 changed:
+ ----- Method: SocketStreamTest>>testUpToAllShortPatternAscii2 (in category 'tests - stream protocol') -----
- ----- 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 changed:
+ ----- Method: SocketStreamTest>>testUpToAllShortPatternBinary (in category 'tests - stream protocol') -----
- ----- 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 changed:
+ ----- Method: SocketStreamTest>>testUpToAllShortPatternBinary2 (in category 'tests - stream protocol') -----
- ----- 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.
!
Item was changed:
+ ----- Method: SocketStreamTest>>testUpToAllTimeout (in category 'tests - stream protocol') -----
- ----- 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 changed:
+ ----- Method: SocketStreamTest>>testUpToAsciiVsBinary (in category 'tests - stream protocol') -----
- ----- Method: SocketStreamTest>>testUpToAsciiVsBinary (in category 'stream protocol') -----
testUpToAsciiVsBinary
"Tests correct behavior of #upTo:"
serverStream ascii.
clientStream nextPutAll:'A line of text', String cr, 'with more text'; flush.
self assert: (serverStream upTo: 13) = 'A line of text'.
serverStream binary.
clientStream nextPutAll: String cr; flush.
self assert: (serverStream upTo: Character cr) asString = 'with more text'.
!
Item was changed:
+ ----- Method: SocketStreamTest>>testUpToEndClose (in category 'tests - stream protocol') -----
- ----- Method: SocketStreamTest>>testUpToEndClose (in category 'stream protocol') -----
testUpToEndClose
"Ensure that #upToEnd will function properly when the connection is closed"
clientStream nextPutAll:'A line of text'; flush.
[(Delay forMilliseconds: 100) wait.
clientStream close] fork.
self assert: (serverStream upToEnd)
equals: 'A line of text'.
!
Item was changed:
+ ----- Method: SocketStreamTest>>testUpToEndCloseNonSignaling (in category 'tests - stream protocol') -----
- ----- Method: SocketStreamTest>>testUpToEndCloseNonSignaling (in category 'stream protocol') -----
testUpToEndCloseNonSignaling
"Ensure that #upToEnd will function properly when the connection is closed"
serverStream shouldSignal: false.
clientStream nextPutAll:'A line of text'; flush.
[(Delay forMilliseconds: 100) wait.
clientStream close] fork.
self assert: (serverStream upToEnd)
equals: 'A line of text'.
!
Item was changed:
+ ----- Method: SocketStreamTest>>testUpToMax (in category 'tests - stream protocol') -----
- ----- 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 changed:
+ ----- Method: SocketStreamTest>>testUpToTimeout (in category 'tests - stream protocol') -----
- ----- 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 changed:
+ ----- Method: SocketTest>>expectedFailures (in category 'failures') -----
- ----- Method: SocketTest>>expectedFailures (in category 'setup') -----
expectedFailures
^ Smalltalk platformName = 'Win32'
ifTrue: [#(testSocketReuse)]
ifFalse: [#()]!
Item was changed:
+ ----- Method: SocketTest>>listenerAddress (in category 'fixtures') -----
- ----- Method: SocketTest>>listenerAddress (in category 'setup') -----
listenerAddress
^NetNameResolver addressForName: 'localhost'
!
Item was changed:
+ ----- Method: SocketTest>>listenerPort (in category 'fixtures') -----
- ----- Method: SocketTest>>listenerPort (in category 'setup') -----
listenerPort
^42324
!
Item was changed:
+ ----- Method: SocketTest>>setUp (in category 'running') -----
- ----- Method: SocketTest>>setUp (in category 'setup') -----
setUp
listenerSocket := Socket newTCP listenOn: self listenerPort backlogSize: 4 interface: self listenerAddress.
!
Item was changed:
+ ----- Method: SocketTest>>tearDown (in category 'running') -----
- ----- Method: SocketTest>>tearDown (in category 'setup') -----
tearDown
listenerSocket ifNotNil:[listenerSocket destroy].
clientSocket ifNotNil:[clientSocket destroy].
serverSocket ifNotNil:[serverSocket destroy].
!
Item was changed:
+ ----- Method: TestURI>>testDefaultDirRoundtrip (in category 'tests - file') -----
- ----- Method: TestURI>>testDefaultDirRoundtrip (in category 'running file') -----
testDefaultDirRoundtrip
| defaultDir defaultURI uriDir |
defaultDir := FileDirectory default.
defaultURI := defaultDir uri.
uriDir := FileDirectory uri: defaultURI.
self should: [defaultDir fullName = uriDir fullName]!
Item was changed:
+ ----- Method: TestURI>>testDirWithHash (in category 'tests - file') -----
- ----- Method: TestURI>>testDirWithHash (in category 'running file') -----
testDirWithHash
"Tests proper escaping of directories with hash mark"
| uriDir origPath origDir dirURI |
origPath := FileDirectory default pathName, '#123'.
origDir := FileDirectory on: origPath.
self assert: origDir pathName = origPath.
dirURI := origDir uri.
uriDir := FileDirectory uri: dirURI.
self assert: origDir fullName = uriDir fullName.!
Item was changed:
+ ----- Method: TestURI>>testDirectoryRoot (in category 'tests - file') -----
- ----- Method: TestURI>>testDirectoryRoot (in category 'running file') -----
testDirectoryRoot
| rootDir uriRoot uriDir |
rootDir := FileDirectory root.
uriRoot := 'file:///' asURI.
uriDir := FileDirectory uri: uriRoot.
self should: [rootDir fullName = uriDir fullName]!
Item was changed:
+ ----- Method: TestURI>>testResolveAbnormal1 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveAbnormal1 (in category 'running resolving') -----
testResolveAbnormal1
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := '../../../g'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/../g'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveAbnormal10 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveAbnormal10 (in category 'running resolving') -----
testResolveAbnormal10
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := './g/.'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/b/c/g/'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveAbnormal11 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveAbnormal11 (in category 'running resolving') -----
testResolveAbnormal11
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := 'g/./h'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/b/c/g/h'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveAbnormal12 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveAbnormal12 (in category 'running resolving') -----
testResolveAbnormal12
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := 'g/../h'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/b/c/h'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveAbnormal13 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveAbnormal13 (in category 'running resolving') -----
testResolveAbnormal13
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := 'g;x=1/./y'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/b/c/g;x=1/y'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveAbnormal14 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveAbnormal14 (in category 'running resolving') -----
testResolveAbnormal14
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := 'g;x=1/../y'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/b/c/y'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveAbnormal15 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveAbnormal15 (in category 'running resolving') -----
testResolveAbnormal15
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := 'g?y/./x'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/b/c/g?y/./x'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveAbnormal16 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveAbnormal16 (in category 'running resolving') -----
testResolveAbnormal16
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := 'g?y/../x'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/b/c/g?y/../x'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveAbnormal17 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveAbnormal17 (in category 'running resolving') -----
testResolveAbnormal17
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := 'g#s/./x'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/b/c/g#s/./x'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveAbnormal18 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveAbnormal18 (in category 'running resolving') -----
testResolveAbnormal18
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := 'g#s/../x'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/b/c/g#s/../x'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveAbnormal2 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveAbnormal2 (in category 'running resolving') -----
testResolveAbnormal2
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := '../../../../g'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/../../g'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveAbnormal3 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveAbnormal3 (in category 'running resolving') -----
testResolveAbnormal3
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := '/./g'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/./g'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveAbnormal4 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveAbnormal4 (in category 'running resolving') -----
testResolveAbnormal4
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := '/../g'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/../g'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveAbnormal5 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveAbnormal5 (in category 'running resolving') -----
testResolveAbnormal5
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := 'g.'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/b/c/g.'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveAbnormal6 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveAbnormal6 (in category 'running resolving') -----
testResolveAbnormal6
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := '.g'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/b/c/.g'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveAbnormal7 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveAbnormal7 (in category 'running resolving') -----
testResolveAbnormal7
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := 'g..'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/b/c/g..'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveAbnormal8 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveAbnormal8 (in category 'running resolving') -----
testResolveAbnormal8
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := '..g'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/b/c/..g'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveAbnormal9 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveAbnormal9 (in category 'running resolving') -----
testResolveAbnormal9
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := './../g'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/b/g'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveNormal1 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveNormal1 (in category 'running resolving') -----
testResolveNormal1
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := 'g:h'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'g:h'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveNormal10 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveNormal10 (in category 'running resolving') -----
testResolveNormal10
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := 'g?y#s'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/b/c/g?y#s'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveNormal11 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveNormal11 (in category 'running resolving') -----
testResolveNormal11
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := ';x'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/b/c/;x'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveNormal12 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveNormal12 (in category 'running resolving') -----
testResolveNormal12
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := 'g;x'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/b/c/g;x'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveNormal13 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveNormal13 (in category 'running resolving') -----
testResolveNormal13
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := 'g;x?y#s'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/b/c/g;x?y#s'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveNormal14 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveNormal14 (in category 'running resolving') -----
testResolveNormal14
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := '.'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/b/c/'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveNormal15 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveNormal15 (in category 'running resolving') -----
testResolveNormal15
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := './'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/b/c/'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveNormal16 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveNormal16 (in category 'running resolving') -----
testResolveNormal16
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := '..'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/b/'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveNormal17 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveNormal17 (in category 'running resolving') -----
testResolveNormal17
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := '../'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/b/'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveNormal18 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveNormal18 (in category 'running resolving') -----
testResolveNormal18
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := '../g'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/b/g'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveNormal19 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveNormal19 (in category 'running resolving') -----
testResolveNormal19
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := '../..'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveNormal2 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveNormal2 (in category 'running resolving') -----
testResolveNormal2
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := 'g'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/b/c/g'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveNormal20 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveNormal20 (in category 'running resolving') -----
testResolveNormal20
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := '../../'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveNormal21 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveNormal21 (in category 'running resolving') -----
testResolveNormal21
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := '../../g'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/g'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveNormal3 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveNormal3 (in category 'running resolving') -----
testResolveNormal3
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := './g'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/b/c/g'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveNormal4 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveNormal4 (in category 'running resolving') -----
testResolveNormal4
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := 'g/'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/b/c/g/'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveNormal5 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveNormal5 (in category 'running resolving') -----
testResolveNormal5
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := '/g'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/g'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveNormal6 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveNormal6 (in category 'running resolving') -----
testResolveNormal6
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := '//g'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://g'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveNormal7 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveNormal7 (in category 'running resolving') -----
testResolveNormal7
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := '?y'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/b/c/?y'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveNormal8 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveNormal8 (in category 'running resolving') -----
testResolveNormal8
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := 'g?y'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/b/c/g?y'].
!
Item was changed:
+ ----- Method: TestURI>>testResolveNormal9 (in category 'tests - resolving') -----
- ----- Method: TestURI>>testResolveNormal9 (in category 'running resolving') -----
testResolveNormal9
| baseURI relURI resolvedURI |
baseURI := 'http://a/b/c/d;p?q' asURI.
relURI := 'g#s'.
resolvedURI := baseURI resolveRelativeURI: relURI.
self should: [resolvedURI asString = 'http://a/b/c/g#s'].
!
Item was changed:
+ ----- Method: TestURI>>testSchemeAbsoluteFail1 (in category 'tests - parsing') -----
- ----- Method: TestURI>>testSchemeAbsoluteFail1 (in category 'running parsing') -----
testSchemeAbsoluteFail1
self should: [URI fromString: 'http:'] raise: IllegalURIException!
Item was changed:
+ ----- Method: TestURI>>testSchemeAbsolutePass1 (in category 'tests - parsing') -----
- ----- Method: TestURI>>testSchemeAbsolutePass1 (in category 'running parsing') -----
testSchemeAbsolutePass1
| uri |
uri := URI fromString: 'http://www.squeakland.org'.
self should: [uri scheme = 'http'].
self should: [uri isAbsolute].
self shouldnt: [uri isOpaque].
self shouldnt: [uri isRelative]!
Item was changed:
+ ----- Method: TestURI>>testSchemeAbsolutePass2 (in category 'tests - parsing') -----
- ----- Method: TestURI>>testSchemeAbsolutePass2 (in category 'running parsing') -----
testSchemeAbsolutePass2
| uri |
uri := URI fromString: 'mailto:somebody at somewhere.nowhere'.
self should: [uri scheme = 'mailto'].
self should: [uri isAbsolute].
self should: [uri isOpaque].
self shouldnt: [uri isRelative]!
Item was changed:
+ ----- Method: TestURI>>testSchemeAbsolutePass3 (in category 'tests - parsing') -----
- ----- Method: TestURI>>testSchemeAbsolutePass3 (in category 'running parsing') -----
testSchemeAbsolutePass3
| uri |
uri := URI fromString: 'ftp://ftp@squeak.org'.
self should: [uri scheme = 'ftp'].
self should: [uri isAbsolute].
self shouldnt: [uri isOpaque].
self shouldnt: [uri isRelative].
self should: [uri userInfo = 'ftp'].
self should: [uri host = 'squeak.org'].
self should: [uri port isNil].
!
Item was changed:
+ ----- Method: TestURI>>testSchemeAbsolutePass4 (in category 'tests - parsing') -----
- ----- Method: TestURI>>testSchemeAbsolutePass4 (in category 'running parsing') -----
testSchemeAbsolutePass4
| uri |
uri := URI fromString: 'mailto:somebody at somewhere.nowhere#fragment'.
self should: [uri scheme = 'mailto'].
self should: [uri isAbsolute].
self should: [uri isOpaque].
self shouldnt: [uri isRelative].
self should: [uri fragment = 'fragment'].
!
Item was changed:
+ ----- Method: TestURI>>testSchemeAbsolutePass5 (in category 'tests - parsing') -----
- ----- Method: TestURI>>testSchemeAbsolutePass5 (in category 'running parsing') -----
testSchemeAbsolutePass5
| uri |
uri := URI fromString: 'http://www.squeakland.org#fragment'.
self should: [uri scheme = 'http'].
self should: [uri isAbsolute].
self shouldnt: [uri isOpaque].
self shouldnt: [uri isRelative].
self should: [uri fragment = 'fragment'].
!
Item was changed:
+ ----- Method: UUIDTest>>testComparison (in category 'tests') -----
- ----- Method: UUIDTest>>testComparison (in category 'as yet unclassified') -----
testComparison
"Test if the comparison operators define a total sort function."
#(
#[3 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0] #[2 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
#[0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 1] #[0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 4]
#[2 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0] #[3 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
#[0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 4] #[0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 1]
#[0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 4] #[0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 4]
) pairsDo: [ :x :y |
| a b c d |
a := UUID newFrom: x.
b := UUID newFrom: y.
c := x asString.
d := y asString.
"Check if the comparison is lexicographical, just like strings'."
#(< > <= >= = ~=) do: [ :operation |
self assert: (a perform: operation with: b) = (c perform: operation with: d) ].
"And a few more"
self
assert: (a < b) = (a >= b) not;
assert: (a > b) = (a <= b) not;
assert: (a = b) = (a ~= b) not;
assert: (a < b) = (b > a);
assert: (a > b) = (b < a);
assert: (a >= b) = (b <= a);
assert: (a <= b) = (b >= a);
assert: (a = b) = (b = a);
assert: (a ~= b) = (b ~= a);
assert: (a > b) = ((a >= b) & (a ~= b));
assert: (a < b) = ((a <= b) & (a ~= b));
assert: (a >= b) = ((a = b) | (a > b));
assert: (a <= b) = ((a = b) | (a < b));
assert: (a ~= b) = ((a < b) | (a > b));
assert: (a <= b) & (b <= a) = (a = b);
assert: (a >= b) & (b >= a) = (a = b);
assert: (a <= b) | (b <= a);
assert: (a = b) asBit + (a < b) asBit + (b < a) asBit = 1 ]!
Item was changed:
+ ----- Method: UrlTest>>testFromFileNameOrUrlString (in category 'tests') -----
- ----- Method: UrlTest>>testFromFileNameOrUrlString (in category 'testing') -----
testFromFileNameOrUrlString
url := Url absoluteFromFileNameOrUrlString: 'asdf'.
self assert: url schemeName = 'file'.
self assert: url fragment isNil.
self assert: url class = FileUrl.
url := Url absoluteFromFileNameOrUrlString: 'http://209.143.91.36/super/SuperSwikiProj/AAEmptyTest.001.pr'.
self assert: url schemeName = 'http'.
self assert: url fragment isNil.
self assert: url class = HttpUrl.!
More information about the Squeak-dev
mailing list
|