<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<meta content="text/html; charset=UTF-8">
<style type="text/css" style="">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p>Hi all, hi Eliot,</p>
<p><br>
</p>
<p>> <span style="font-size:12pt">> What do you mean by this? Such a TestCase receiver environment should </span><span style="font-size:12pt">definitively be not the default, this would be very confusing!</span></p>
<div>> </div>
<div>> Oh interesting! What kind of confusion do you foresee? I had just <span style="font-size:12pt">imagined that the only visible-ish change would be availability of </span><span style="font-size:12pt">TestCase instance-side methods on the "self" in the
 Workspace.</span></div>
<div><br>
</div>
<div>SUnit is just one of so many domains. Someone else might want to evaluate things in the context of Transcript (self showln: 'foo') or any other console host (name := self input: 'Your name?'. self output: 'Hello ' , name) etc. pp....</div>
<div><br>
</div>
<div>@AssertResults via reflection:</div>
<div><br>
</div>
<div>Highly interesting topic! I already had some thoughts about this last summer and I have an image containing some stubs for it. My basic idea was to pass only blocks to the #assert: method that can more easily be decompiled, reevaluated, and whatever you
 wish. One then could identify the receiver "X" of the last message from the assertion block "X y: Z" and transform this message send into "X assert: #y: with: {Z}", where #assert:with: would be implemented on Object and could dispatch the assertion selector
 to several extension methods. This would allow us, for example, to write</div>
<div>self assert: [myList noneSatisfy: [:ea | ea hasPlung]]</div>
<div>and TestCase >> #assert:, under the hood, would this transform into</div>
<div>self assert: [myList assert: #noneSatisfy: with: [:ea | ea even]]</div>
<div>and then, an extension method á la #assertNoneSatisfy: could be called from #assert:with: and instead of only signaling a generic AssertionFailure, we could see something like:</div>
<p></p>
<div id="x_Signature">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div name="x_divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div>
<div class="x__rp_T4" id="x_Item.MessagePartBody">
<div class="x__rp_U4 x_ms-font-weight-regular x_ms-font-color-neutralDark x_rpHighlightAllClass x_rpHighlightBodyClass" id="x_Item.MessageUniqueBody" style="font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont">
<div dir="ltr">
<div id="x_divtagdefaultwrapper"><font face="Calibri,Helvetica,sans-serif,EmojiFont,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols">
<div id="x_Signature">
<div style="margin:0px"><font style="font-family:Calibri,Arial,Helvetica,sans-serif,serif,EmojiFont">
<div><font size="3" color="black"><span style="font-size:12pt"><a href="http://www.hpi.de/" target="_blank" rel="noopener noreferrer" id="LPNoLP"><font size="2"><span id="LPlnk909538"><font color="#757B80"></font></span></font></a></span></font></div>
</font></div>
</div>
</font></div>
</div>
</div>
</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody">"No object in myList should satisfy [:ea | ea even], but 4 (at index 2) does satisfy."</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody"><br>
</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody">As a plus, every package/framework developer could simply add support for customized AssertionFailures by overriding that #assert:with: and handling custom test selectors.</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody">If we wanted to go one step further, we could even try to detect nested calls, e.g.:</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody">self assert: [(myList anySatisfy: [:ea | ea hasPlung]]) and: [myList size even]]</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody">"myList should satisfy myList size even but did not"</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody"><span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px">"myList should satisfy myList size </span><span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px">even but size
 is 5"</span><br>
</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody"><br>
</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody">Ha, what a dream! And it shouldn't be terribly complicated, too ... For more inspiration, take a look at FluentAssertions for C#. :-)</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody">(If anyone asks: I never realized this projects because I did not know what to do if one of these parameters has side effects, e.g. when a block is called. Any ideas?)</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody"><br>
</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody">Best,</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody">Christoph</div>
</div>
<div><font size="2" color="#808080"></font></div>
</div>
</div>
</div>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Von:</b> Squeak-dev <squeak-dev-bounces@lists.squeakfoundation.org> im Auftrag von Jakob Reschke <forums.jakob@resfarm.de><br>
<b>Gesendet:</b> Montag, 12. Oktober 2020 21:27:48<br>
<b>An:</b> squeak-dev@lists.squeakfoundation.org<br>
<b>Betreff:</b> Re: [squeak-dev] assert:equals: in Object</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">Eliot Miranda-2 wrote<br>
> - appealing to the SUnit community to reverse the order of arguments to<br>
> assert:equals:, plus a rewrite rule that reversed the obvious cases where<br>
> the first argument is a literal constant.<br>
<br>
For what it is worth, Pharo has just swapped the parameters... which makes<br>
all "portable" test cases awkward.<br>
<br>
<br>
<br>
--<br>
Sent from: <a href="http://forum.world.st/Squeak-Dev-f45488.html">http://forum.world.st/Squeak-Dev-f45488.html</a><br>
<br>
</div>
</span></font>
</body>
</html>