Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix OptionIdOps.some to always return Some #873

Merged
merged 4 commits into from
Feb 24, 2016

Conversation

vpavkin
Copy link
Contributor

@vpavkin vpavkin commented Feb 10, 2016

Fix #871


test("OptionIdOps.some"){
val s: String = null
s.some.contains(s) should === (true)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Due to NPE I wasn't able to write it as s.some should === (Some(null))

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks, @vpavkin!

Would you mind leaving a comment in the code itself about why it's done this way?

Also, would you mind naming the test something that better identifies that it's checking for behavior when null is passed in? Maybe something like test(".some with null argument still results in Some #871").

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like Option.contains isn't available on Scala 2.10

@vpavkin
Copy link
Contributor Author

vpavkin commented Feb 11, 2016

@ceedubs my bad. Added more comments and changed code to use exists, which should work for 2.10.
Let's see what travis thinks about it.

@codecov-io
Copy link

Current coverage is 89.34%

Merging #873 into master will increase coverage by +0.06% as of 6821a96

@@            master    #873   diff @@
======================================
  Files          168     169     +1
  Stmts         2323    2337    +14
  Branches        75      75       
  Methods          0       0       
======================================
+ Hit           2074    2088    +14
  Partial          0       0       
  Missed         249     249       

Review entire Coverage Diff as of 6821a96

Powered by Codecov. Updated on successful CI builds.

@@ -76,4 +76,12 @@ class OptionTests extends CatsSuite {
isEq.lhs should === (isEq.rhs)
}
}

// a test for OptionIdOps.some to return Some even if the argument is null
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment probably isn't really needed since the test name says basically the same thing.

@ceedubs
Copy link
Contributor

ceedubs commented Feb 11, 2016

👍 thanks a bunch, @vpavkin!

@vpavkin
Copy link
Contributor Author

vpavkin commented Feb 12, 2016

updated comment :)

@stew
Copy link
Contributor

stew commented Feb 24, 2016

👍

stew added a commit that referenced this pull request Feb 24, 2016
Fix OptionIdOps.some to always return Some
@stew stew merged commit 9deea3b into typelevel:master Feb 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants