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.

Arrow Extension - `should beRight` lambda expression support

See original GitHub issue

To test the returned value of an Either I am using:

val either = passwordColumn.loadType(com.google.gson.JsonPrimitive("73^pickles"))
either.shouldBeRight()
val password = (either as Either.Right<Password?>).b
password.shouldNotBe(null)
password!!.hashedPassword.shouldNotBe(null)
password.useExistingValue.shouldBe(false)

It would be nicer to be able to use lambda expression support, such as:

passwordColumn.loadType(com.google.gson.JsonPrimitive("73^pickles")).shouldBeRight {
	it.shouldNotBe(null)
	it!!.hashedPassword.shouldNotBe(null)
	it.useExistingValue.shouldBe(false)
}

Note: passwordColumn.loadType(...) returns Either<ValidationError, Password?>.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
sksamuelcommented, Feb 13, 2019

We should add the lambda version for now ?

0reactions
sksamuelcommented, Jun 25, 2019

Yep

On Tue, 25 Jun 2019 at 13:54, Leonardo Colman Lopes < notifications@github.com> wrote:

Can this be closed?

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/kotlintest/kotlintest/issues/612?email_source=notifications&email_token=AAFVSGSJYP3RR6ZHTJ777CDP4JSV7A5CNFSM4GSR4JN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYRHTNI#issuecomment-505575861, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFVSGWKAVRNR7RYFJW3WETP4JSV7ANCNFSM4GSR4JNQ .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Lambda Expressions: A Guide
A guide to programming lambda expressions in C++, C#, Java, Javascript, and Python by JoshData. A lambda expression is a convenient syntax available...
Read more >
The `=>` operator is used to define a lambda expression in C# ...
The C# => operator defines lambda expressions and expression bodied members. Lambda expressions define a block of code used as data.
Read more >
Java 8: Formatting lambda with newlines and indentation
Eclipse (Mars) has an option for lambda expressions formatter. Go to Window > Preferences > Java ... I share it by thinking that...
Read more >
JavaScript's Lambda and Arrow Functions - Vinta Blog
Introducing anonymous functions and arrow functions in JavaScript ES6.
Read more >
https://inst.eecs.berkeley.edu/~cs61a/reader/mt3-2...
An arrow to a pair points to the entire pair, not just to its car or its cdr. ... In particular, the inner...
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