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

Jakob Reschke forums.jakob at resfarm.de
Fri Apr 10 09:36:37 UTC 2020


The patterns matched by match: are not regular expressions. Could this
intermixing of vocabulary lead to confusion or even bugs (when someone
is missing a test for their matching use case and forgot the asRegex)?

Am Do., 9. Apr. 2020 um 14:39 Uhr schrieb Thiede, Christoph
<Christoph.Thiede at student.hpi.uni-potsdam.de>:
>
> 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?
>
>
> 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!
>
>
>


More information about the Squeak-dev mailing list