question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Would it be possible to add an or conjunction for the case that there are multiple ways to pass a test?

Example:

val value: String = nextMagicValue()
expectThat(value).or {
    isEqualTo("3.14")
    isEqualTo("42")
}

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:4
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
cjbrooks12commented, Dec 21, 2019

Personally, I think the proposed syntax is a bit odd. If it opens a lambda, maybe it should be anyOf or oneOf or something along those lines? Or maybe or could be an infix operator?

val value: String = nextMagicValue()
expectThat(value).oneOf {
    isEqualTo("3.14")
    isEqualTo("42")
}
val value: String = nextMagicValue()
expectThat(value) {
    isEqualTo("3.14") or isEqualTo("42")
}
2reactions
robfletchercommented, Dec 21, 2019

It should be possible, I think. It’s fundamentally similar to the any conjunction that already exists for Assertion.Builder<Iterable<*>>.

Read more comments on GitHub >

github_iconTop Results From Across the Web

OR (conjunction) definition and synonyms | Macmillan Dictionary
Definition of OR (conjunction): used for showing possibilities or choices; and not; when you do not know exact number; used in warnings, threats,...
Read more >
or conjunction - Oxford Learner's Dictionaries
or · ​. used to introduce another possibility · ​. used in negative sentences when mentioning two or more things · ​. (also...
Read more >
The conjunctions and, or and but - EnglishGrammar.org
The most important among the coordinating conjunctions are and, but and or. Let's explore the uses of these three little words. And.
Read more >
Coordinating conjunctions: so, and, but, or, yet, for, nor
Conjunctions are words which connect sentences or groups of words. Some learners know them as connectors or joining words. One type of conjunction...
Read more >
Or Definition & Meaning | Britannica Dictionary
OR meaning: 1 : used to introduce another choice or possibility; 2 : used in negative statements to introduce something else that is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found