Hello.
I prepare new version of Mocketry with many new functions. And I have little question about some naming. It will be possible to verify (at the end of test) that particular message was happened. My first suggestion was:
But from English it not sounds like it should be occurred in past. So what correct and not long sentence can be used here? maybe:
And same question for verification group of message sends (at the end of test):
Does it sounds correct? What suggestions? Best regards, Denis |
mock should haveReceived someMessage
[ mock someMessage. mock2 somMessage2 ] should have beenSent
Cheers, Max
|
2016-03-23 11:02 GMT+01:00 Max Leske <[hidden email]>:
Thank's for suggestions. Thats idea from Marcus too. But it feels too long. But maybe. Now I actually already rename #receive to #haveReceived. But I hope for better sentence.
It's long too. And I wish reduce number of separated words because it is not good practically. It raises more questions: how it is implemented, what the better name for intermediate object (result of have in that case) and others. At least your suggestion will be like [ mock someMessage. mock2 somMessage2 ] should haveBeenSent Another idea is to use #happen word: [ mock someMessage. mock2 somMessage2 ] should happen |
On Wed, Mar 23, 2016 at 6:31 PM, Denis Kudriashov <[hidden email]> wrote:
> > 2016-03-23 11:02 GMT+01:00 Max Leske <[hidden email]>: >> >> But from English it not sounds like it should be occurred in past. Normally thats my cue ;) but I don't have any great ideas. >> So what correct and not long sentence can be used here? maybe: >> >> mock had received someMessage >> >> >> mock should haveReceived someMessage >> > > Thank's for suggestions. Thats idea from Marcus too. But it feels too long. > But maybe. Now I actually already rename #receive to #haveReceived. But I > hope for better sentence. >> >> >> And same question for verification group of message sends (at the end of >> test): >> >> [mock someMessage. mock2 someMessage2] should occur >> >> [mock someMessage. mock2 someMessage2] should occurInSameOrder >> >> >> [ mock someMessage. mock2 somMessage2 ] should have beenSent > > > It's long too. And I wish reduce number of separated words because it is not > good practically. Maybe... [ mock someMessage. mock2 somMessage2 ] shouldve beenSent but maybe you don't want different #shouldXXX messages. cheers -ben > It raises more questions: how it is implemented, what the > better name for intermediate object (result of have in that case) and > others. > At least your suggestion will be like > [ mock someMessage. mock2 somMessage2 ] should haveBeenSent > > Another idea is to use #happen word: > [ mock someMessage. mock2 somMessage2 ] should happen |
2016-03-23 12:38 GMT+01:00 Ben Coman <[hidden email]>:
Thank you too, Ben. And yes it will not follow other should expressions. But it would not be bad to use completely different word instead of #should |
On Wed, Mar 23, 2016 at 8:39 PM, Denis Kudriashov <[hidden email]> wrote:
> > 2016-03-23 12:38 GMT+01:00 Ben Coman <[hidden email]>: >> >> Maybe... >> [ mock someMessage. mock2 somMessage2 ] shouldve beenSent >> >> but maybe you don't want different #shouldXXX messages. > > > Thank you too, Ben. And yes it will not follow other should expressions. But > it would not be bad to use completely different word instead of #should Okay, then perhaps... [mock someMessage. mock2 someMessage2] were sent [mock someMessage. mock2 someMessage2] were sentInOrder [mock someMessage. mock2 someMessage2] were done [mock someMessage. mock2 someMessage2] were doneInOrder but then do you also need singular #was for single items? [mock someMessage. mock2 someMessage2] expect done [mock someMessage. mock2 someMessage2] expect doneInOrder Expect squeezes in usage in both future and past tense... "I expect he'll arrive soon" "I expect he went home" cheers -ben |
2016-03-23 14:05 GMT+01:00 Ben Coman <[hidden email]>:
I really like this idea. Thank's. What about: [mock someMessage. mock2 someMessage2] should beDone [mock someMessage. mock2 someMessage2] should beDoneInOrder ? |
In reply to this post by Ben Coman
On Wed, Mar 23, 2016 at 6:05 AM, Ben Coman <[hidden email]> wrote:
IMO use "was done/was doneInOrder". It is correct English to say "a compound action was performed". In any case it is the block that is evaluated, and that's a singular item. [mock someMessage. mock2 someMessage2] expect done _,,,^..^,,,_ best, Eliot |
In reply to this post by Denis Kudriashov
Hi Denis,
On Wed, Mar 23, 2016 at 9:39 AM, Denis Kudriashov <[hidden email]> wrote:
[mock someMessage. mock2 someMessage2] executed completely [mock someMessage. mock2 someMessage2] executed completelyInOrder and then #executed is meaningful, whereas #should is merely a linguistic hack. And of course one could use #executes, but I think #executed is better; it has the sense of [mock someMessage. mock2 someMessage2] when executed, #executes completely :-) _,,,^..^,,,_ best, Eliot |
2016-03-23 19:39 GMT+01:00 Eliot Miranda <[hidden email]>:
It returns ShouldExpression instance which wraps receiver to execute following messages. And following messages are supposed to execute some assertions under receiver. For example it can be "1 should be: 2". Or in case with block: "[1/0] should raise: ZeroDivide" And for message sends verification I tried to find something similar.
|
On Wed, Mar 23, 2016 at 12:04 PM, Denis Kudriashov <[hidden email]> wrote:
Personally I would rename ShouldExpression to ExecutedBlock or ExecutedExpression, keep #should as nice syntactic sugar, but provide #executed as the standard way of creating ExecutedExpressions. After all this is useful for more than SUnit.
_,,,^..^,,,_ best, Eliot |
2016-03-23 21:21 GMT+01:00 Eliot Miranda <[hidden email]>: Personally I would rename ShouldExpression to ExecutedBlock or ExecutedExpression, keep #should as nice syntactic sugar, but provide #executed as the standard way of creating ExecutedExpressions. After all this is useful for more than SUnit. Thank's for suggestion Eliot. I would think about it. Underhood should expressions are based on reusable components which has no relation to tests. It is first class specifications of object state. Should expression just creates particular instance of spec to validate receiver by it. So ShouldExpression is just syntax sugar helper class. It not implements any "real" behaviour. |
Free forum by Nabble | Edit this page |