The Trunk: CollectionsTests-mt.227.mcz

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

The Trunk: CollectionsTests-mt.227.mcz

commits-2
Marcel Taeumel uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-mt.227.mcz

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

Name: CollectionsTests-mt.227
Author: mt
Time: 14 January 2015, 12:48:32.028 pm
UUID: ba80ec03-2785-4642-9a8c-09ad419fe738
Ancestors: CollectionsTests-mt.226

Tests added for #join

=============== Diff against CollectionsTests-mt.226 ===============

Item was added:
+ ----- Method: SequenceableCollectionTest>>testJoin (in category 'tests - converting') -----
+ testJoin
+
+ self assert: #(a b c d e) join = 'abcde'.
+ self assert: (#(a b c) joinSeparatedBy: '|') = 'a|b|c'.!

Item was added:
+ ----- Method: SequenceableCollectionTest>>testSplitAndJoin (in category 'tests - converting') -----
+ testSplitAndJoin
+
+ self assert: (('a|b|c' splitBy: '|') joinSeparatedBy: '|') = 'a|b|c'.!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: CollectionsTests-mt.227.mcz

Frank Shearar-3
On 14 January 2015 at 11:48,  <[hidden email]> wrote:

> Marcel Taeumel uploaded a new version of CollectionsTests to project The Trunk:
> http://source.squeak.org/trunk/CollectionsTests-mt.227.mcz
>
> ==================== Summary ====================
>
> Name: CollectionsTests-mt.227
> Author: mt
> Time: 14 January 2015, 12:48:32.028 pm
> UUID: ba80ec03-2785-4642-9a8c-09ad419fe738
> Ancestors: CollectionsTests-mt.226
>
> Tests added for #join
>
> =============== Diff against CollectionsTests-mt.226 ===============
>
> Item was added:
> + ----- Method: SequenceableCollectionTest>>testJoin (in category 'tests - converting') -----
> + testJoin
> +
> +       self assert: #(a b c d e) join = 'abcde'.
> +       self assert: (#(a b c) joinSeparatedBy: '|') = 'a|b|c'.!
>
> Item was added:
> + ----- Method: SequenceableCollectionTest>>testSplitAndJoin (in category 'tests - converting') -----
> + testSplitAndJoin
> +
> +       self assert: (('a|b|c' splitBy: '|') joinSeparatedBy: '|') = 'a|b|c'.!

+1 to the feature!

I'd just add that using #assert:equals: gives better error messages:

    self assert: 'a|b|c' equals: (#(a b c) joinSeparatedBy: '|')

and so on.

frank

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: CollectionsTests-mt.227.mcz

marcel.taeumel (old)
Ah, thanks. :) All those basic tests should be fast to debug during release time. ;)

Best,
Marcel
Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: CollectionsTests-mt.227.mcz

marcel.taeumel (old)
... however, we should to a batch conversion? There are many such tests that would benefit from #assert:equals:.

Best,
Marcel
Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: CollectionsTests-mt.227.mcz

Frank Shearar-3
They should, but if you're running the tests in some headless fashion
- like in CI - those error messages let you zero in on problems much
faster than just seeing "this test failed".

I don't doubt that many tests would benefit from such a conversion: I
just haven't done such a thing because of a lack of time, so I try get
people to rewrite their new tests as they go in :)

frank

On 14 January 2015 at 12:20, Marcel Taeumel
<[hidden email]> wrote:

> ... however, we should to a batch conversion? There are many such tests that
> would benefit from #assert:equals:.
>
> Best,
> Marcel
>
>
>
> --
> View this message in context: http://forum.world.st/The-Trunk-CollectionsTests-mt-227-mcz-tp4799475p4799483.html
> Sent from the Squeak - Dev mailing list archive at Nabble.com.
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: CollectionsTests-mt.227.mcz

Tobias Pape

On 15.01.2015, at 10:59, Frank Shearar <[hidden email]> wrote:

> They should, but if you're running the tests in some headless fashion
> - like in CI - those error messages let you zero in on problems much
> faster than just seeing "this test failed".
>
> I don't doubt that many tests would benefit from such a conversion: I
> just haven't done such a thing because of a lack of time, so I try get
> people to rewrite their new tests as they go in :)

If we batch-convert, can we please also change

        self assert: expected equals: actual

to

        self assert: actual equals: given

? This is IMHO more readable.
If this is a naming problem, what about

        self expect: actual toBe: given

Best
        -Tobias

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: CollectionsTests-mt.227.mcz

Frank Shearar-3
On 15 January 2015 at 11:05, Tobias Pape <[hidden email]> wrote:

>
> On 15.01.2015, at 10:59, Frank Shearar <[hidden email]> wrote:
>
>> They should, but if you're running the tests in some headless fashion
>> - like in CI - those error messages let you zero in on problems much
>> faster than just seeing "this test failed".
>>
>> I don't doubt that many tests would benefit from such a conversion: I
>> just haven't done such a thing because of a lack of time, so I try get
>> people to rewrite their new tests as they go in :)
>
> If we batch-convert, can we please also change
>
>         self assert: expected equals: actual
>
> to
>
>         self assert: actual equals: given
>
> ? This is IMHO more readable.
> If this is a naming problem, what about
>
>         self expect: actual toBe: given

I'd rather take the latter option then. #assert:equals: does take the
expected value first, and swapping the values reads better but then
gives a deeply misleading message... and adjusting the message means
there's a huge disconnect between our SUnit and the standard
cross-platform SUnit.

frank

> Best
>         -Tobias
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: CollectionsTests-mt.227.mcz

Tobias Pape

On 15.01.2015, at 12:11, Frank Shearar <[hidden email]> wrote:

> On 15 January 2015 at 11:05, Tobias Pape <[hidden email]> wrote:
>>
>> On 15.01.2015, at 10:59, Frank Shearar <[hidden email]> wrote:
>>
>>> They should, but if you're running the tests in some headless fashion
>>> - like in CI - those error messages let you zero in on problems much
>>> faster than just seeing "this test failed".
>>>
>>> I don't doubt that many tests would benefit from such a conversion: I
>>> just haven't done such a thing because of a lack of time, so I try get
>>> people to rewrite their new tests as they go in :)
>>
>> If we batch-convert, can we please also change
>>
>>        self assert: expected equals: actual
>>
>> to
>>
>>        self assert: actual equals: given
>>
>> ? This is IMHO more readable.
>> If this is a naming problem, what about
>>
>>        self expect: actual toBe: given
>
> I'd rather take the latter option then. #assert:equals: does take the
> expected value first, and swapping the values reads better but then
> gives a deeply misleading message... and adjusting the message means
> there's a huge disconnect between our SUnit and the standard
> cross-platform SUnit.

yeah, you're right.
But using something like #expect:toBe: is then not portable either :(
Guess we'll stick with it until there's a new Framework ;)

Best
        -Tobias