-
-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make it easier to diagnose mock failures by printing message sends pr…
…operly and storing the send history in the mock
- Loading branch information
Showing
3 changed files
with
79 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
" | ||
A MockMessageSendTest is a test class for testing the behavior of MockMessageSend | ||
" | ||
Class { | ||
#name : 'MockMessageSendTest', | ||
#superclass : 'TestCase', | ||
#instVars : [ | ||
'mockMessage', | ||
'testStream' | ||
], | ||
#category : 'SUnit-MockObjects-Tests-Core', | ||
#package : 'SUnit-MockObjects-Tests', | ||
#tag : 'Core' | ||
} | ||
|
||
{ #category : 'running' } | ||
MockMessageSendTest >> setUp [ | ||
|
||
super setUp. | ||
testStream := WriteStream on: '' | ||
|
||
] | ||
|
||
{ #category : 'running' } | ||
MockMessageSendTest >> testBinaryMessagePrintOn [ | ||
mockMessage := MockMessageSend on: #binaryMsg: with: #(true) do: [ ]. | ||
|
||
mockMessage printOn: testStream. | ||
|
||
self assert: (testStream contents includesSubstring: '#binaryMsg: true') | ||
] | ||
|
||
{ #category : 'running' } | ||
MockMessageSendTest >> testKeywordMessageArrayPrintOn [ | ||
mockMessage := MockMessageSend on: #keyWord:msg: with: #('hello' #(1 2 3)) do: [ ]. | ||
|
||
mockMessage printOn: testStream. | ||
|
||
self assert: (testStream contents includesSubstring: '#keyWord:msg: ( ''hello'', #(1 2 3) )') | ||
] | ||
|
||
{ #category : 'running' } | ||
MockMessageSendTest >> testKeywordMessagePrintOn [ | ||
mockMessage := MockMessageSend on: #keyWord:msg: with: #('hello' 'world') do: [ ]. | ||
|
||
mockMessage printOn: testStream. | ||
|
||
self assert: (testStream contents includesSubstring: '#keyWord:msg: ( ''hello'', ''world'' )') | ||
] | ||
|
||
{ #category : 'running' } | ||
MockMessageSendTest >> testUnaryMessagePrintOn [ | ||
mockMessage := MockMessageSend on: #unaryMsg with: #() do: [ ]. | ||
|
||
mockMessage printOn: testStream. | ||
|
||
self assert: (testStream contents includesSubstring: '#unaryMsg') | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters