Skip to content
This repository has been archived by the owner on Oct 28, 2022. It is now read-only.

Allow Comparator alias parameter to be a function template. #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

FeepingCreature
Copy link
Contributor

No description provided.

@FeepingCreature FeepingCreature requested a review from belka-ew July 1, 2020 06:10
Copy link
Collaborator

@belka-ew belka-ew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now invalid comparators are just skipped without any error messages, it makes it hard to debug, what is wrong.

Please add some test(s).

@FeepingCreature
Copy link
Contributor Author

FeepingCreature commented Jul 1, 2020

Hm. You're right, that's a bad problem.
99% of the time, the comparators just do to!string comparisons. Could that be handled by a built-in helper?

@belka-ew
Copy link
Collaborator

belka-ew commented Jul 1, 2020

Hm. You're right, that's a bad problem.
99% of the time, the comparators just do to!string comparisons. Could that be handled by a built-in helper?

We could add a ready-to-use comparator, but I personally wouldn't like to enable it by default. Default comparison is done with .opEquals, but the .to!string-comparison seems to be too Funkwerk-specific to me. Comparators can be configured once per Mocker instance; so you can just define a custom mocker instance and use it across projects?

@FeepingCreature
Copy link
Contributor Author

Yes, the problem is that Mocker may have to compare very many kinds of parameters, and there's no nice way to discover what they are other than looking what tests fail.

I wasn't thinking enable-by-default, more like expect.foo().toStringComparator or such.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants