[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-smalltalk] [PATCH] sunit: Add >>#assert:equals: from Pharo for
From: |
Paolo Bonzini |
Subject: |
Re: [Help-smalltalk] [PATCH] sunit: Add >>#assert:equals: from Pharo for the Phexample |
Date: |
Thu, 27 Jun 2013 11:57:56 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6 |
Il 17/06/2013 10:09, Holger Hans Peter Freyther ha scritto:
> The above selector is needed for Phexample and in general very
> nice to debug failures as the result and expectation is immediately
> visible in the debugger.
>
> 2013-05-11 Holger Hans Peter Freyther <address@hidden>
>
> * packages/sunit/SUnit.st: Add #assert:equals: and
> #comparingStringBetween:and: from Pharo to the TestCase.
> ---
> packages/sunit/ChangeLog | 5 +++++
> packages/sunit/SUnit.st | 18 ++++++++++++++++++
> 2 files changed, 23 insertions(+)
>
> diff --git a/packages/sunit/ChangeLog b/packages/sunit/ChangeLog
> index 56a52cf..bdb12a7 100644
> --- a/packages/sunit/ChangeLog
> +++ b/packages/sunit/ChangeLog
> @@ -1,3 +1,8 @@
> +2013-05-11 Holger Hans Peter Freyther <address@hidden>
> +
> + * packages/sunit/SUnit.st: Add #assert:equals: and
> + #comparingStringBetween:and: from Pharo to the TestCase.
> +
> 2012-08-03 Holger Hans Peter Freyther <address@hidden>
>
> * packages/sunit/SUnit.st: Use testSelector printString as
> diff --git a/packages/sunit/SUnit.st b/packages/sunit/SUnit.st
> index 58b3ab0..38a872b 100644
> --- a/packages/sunit/SUnit.st
> +++ b/packages/sunit/SUnit.st
> @@ -847,6 +847,13 @@ When you are writing a test case method, send #assert:
> aBoolean when you want to
> exception sunitSignalWith: aString]
> ]
>
> + assert: actual equals: expected [
> + <category: 'Accessing'>
> + ^ self
> + assert: expected = actual
> + description: [self comparingStringBetween: actual and: expected]
> + ]
> +
> deny: aBoolean [
> <category: 'Accessing'>
> self assert: aBoolean not
> @@ -1085,6 +1092,17 @@ When you are writing a test case method, send #assert:
> aBoolean when you want to
> testSelector := aSymbol
> ]
>
> + comparingStringBetween: actual and: expected [
> + <category: 'Private'>
> + ^ String streamContents: [:stream |
> + stream
> + nextPutAll: 'Got ';
> + nextPutAll: actual printString;
> + nextPutAll: ' instead of ';
> + nextPutAll: expected printString;
> + nextPutAll: '.']
> + ]
> +
> addDependentToHierachy: anObject [
> "an empty method. for Composite compability with TestSuite"
>
>
Please apply!
Paolo