[squeak-dev] The Inbox: Collections-ct.885.mcz

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Thu Apr 9 12:38:59 UTC 2020


See also SUnit-ct.127 (#assert:matches:) or Tests-ct.429 (#assertText:) in the Inbox which could benefit from this extension.


I would also welcome to completely rename #match: into #matches: for the reasons described below, how would you think about this?

Or should String >> #matches: rather be an extension method from the Regex-Core package?

<http://www.hpi.de/>

Best,
Christoph
________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von commits at source.squeak.org <commits at source.squeak.org>
Gesendet: Donnerstag, 9. April 2020 14:35:36
An: squeak-dev at lists.squeakfoundation.org
Betreff: [squeak-dev] The Inbox: Collections-ct.885.mcz

Christoph Thiede uploaded a new version of Collections to project The Inbox:
http://source.squeak.org/inbox/Collections-ct.885.mcz

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

Name: Collections-ct.885
Author: ct
Time: 9 April 2020, 2:35:32.800949 pm
UUID: ddccd842-af02-a448-91f7-7556c8c7bf43
Ancestors: Collections-dtl.884

Proposal for discussion: Add String >> #matches: for polymorphy with RxMatcher.

This allows you to pass patterns strings whereever a RxMatcher is expected. Furthermore, IMHO the name #matches: gives you a better intuition for a test selector than #match: does.

| password patterns |
patterns := { '.{8,}' asRegex. '*password*'. '.*\d.*' asRegex }.
password := Project uiManager requestPassword: 'Enter a fake password'.
self assert: (patterns allSatisfy: [:pattern | pattern matches: password]) description: 'Your password is not safe enough'.

=============== Diff against Collections-dtl.884 ===============

Item was added:
+ ----- Method: String>>matches: (in category 'comparing') -----
+ matches: text
+        "For polymorphy with RxMatcher."
+
+        ^ self match: text!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200409/440eded5/attachment.html>


More information about the Squeak-dev mailing list