Extend the set of comparison operations permitted#92
Extend the set of comparison operations permitted#92rpgoldman wants to merge 4 commits intolispci:masterfrom
Conversation
Previously FiveAM used a home-brewed matching construct to process `is` forms in tests. Replaced this home-brew matcher (which was only used in one place in the code) by a dependency on the "trivia" pattern-matching library.
The new matcher allows us to have comparisons with modifier arguments,
such as
(set-equal X Y :test 'equalp)
which could not be handled by previous versions of FiveAM.
The change in this branch is backwards compatible, but tests that are constructed using some newly-available comparison operations will not be usable in the previous version of FiveAM.
| nil)) | ||
| |# | ||
|
|
||
| (defun list-match-pattern->trivia (pattern) |
There was a problem hiding this comment.
Does this make a dependency on trivia?
There was a problem hiding this comment.
Yes, it does. I looked at list-match-case and it was too much trouble to figure it out to fix a single case statement.
If one doesn't like the dependency on trivia, it would probably be better to rewrite the case statement in the is macro into a hand-coded multi-way branch: that would be easier than trying to understand the hand-written matcher well enough to fix it.
There was a problem hiding this comment.
OK. I'm not the maintainer of fiveam.
But there are Cl implementations that don't work well with trivia, like ABCL.
fiveam should work with the largest set of CL implementations.
There was a problem hiding this comment.
Is there a workaround to not using Trivia but make your set-equa usecase work?
There was a problem hiding this comment.
OK. I'm not the maintainer of fiveam. But there are Cl implementations that don't work well with trivia, like ABCL. fiveam should work with the largest set of CL implementations.
I did not know about that. Do you have any pointers to information about trivia's (in)compatibility with various lisp implementations?
I agree with you that 5AM should aim to be as portable as possible.
There was a problem hiding this comment.
@mdbergmann I believe that the best work-around -- although it is not good -- would be simply to rip out the use of pattern-matching and have a hand-written cond expression with destructuring-bind.
As I implied earlier, there's a lot more code to make list-match-case work than there is actual use of this macro!
Another possibility is that the uses of trivia here are so limited that maybe they will work on any lisp implementation even ABCL. Again, it would help to know what breaks on ABCL.
It would be nice if 5AM had some github-actions to run the tests on multiple lisp implementations (like we have for ASDF and ITERATE on common-lisp.net).
There was a problem hiding this comment.
I just tried on ABCL. Trivia can be compiled and basic pattern matching works.
But running the whole test suite for some reason fails, though for some other reason than trivia.
I wanted to be able to use
alexandria:set-equalas a comparison operation in FiveAM tests. This turned out to be impossible (except by usingtest-true), because theismacro did not accept extra, modifier arguments such asThe reason for this limitation was that FiveAM used a home-brewed matching construct to process
isforms in tests.In this PR I have replaced FiveAM's home-brew matcher (which was only used in one place in the code) by a dependency on the "trivia" pattern-matching library. This was a judgment call, but figuring out the undocumented list matcher seemed more trouble than it was worth.