-
Notifications
You must be signed in to change notification settings - Fork 80
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
Cleanup VersionNumberSpec #221
Conversation
class VersionNumberSpec extends UnitSpec with Inside { | ||
import VersionNumber.{ SemVer, SecondSegment } | ||
|
||
version("1") { implicit v => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The overall looks is cleaner, but I am not really sure if I like implicit
used just so it doesn't pass in one parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can change that implementation detail
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another sort of meta question is: Do we make custom DSL for each spec / unit tests we write that reads like English statements? I'd much rather prefer we used something like JUnit or Minitest, if we are moving away from plain UnitSpec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy to discuss and/or experiment with alternatives to UnitSpec.
but note that I'm not moving away from UnitSpec in this PR.
I am in favour of creating helper methods to remove lots of repetition and improve legibility (and maintainability), but the fact that it reads like English statements is not my objective.
I'm not sure where the line is drawn between creating a few helper methods and removing repetition becomes a "custom DSL".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"1" should "be parsed" in beParsedAs("1", Seq(1), Seq(), Seq())
it should "breakdown" in breakDownTo("1", Some(1))
In the above, beParsedAs
is an English style helper function idiomatic to ScalaTest's FlatSpec
.
but note that I'm not moving away from UnitSpec in this PR.
I'd say you've made our own SomethingSpec that internally uses FlatSpec
. I really like it, but I also want to stick to an existing test framework, esp if we want others to follow it. Perhaps the style we should migrate is FunSuite
:
test("1") {
val v = "1"
assertParsesTo(v, Seq(1), Seq(), Seq())
assertBreaksDownTo(v, Some(1))
assertCascadesTo(v, Seq("1"))
}
Less noise. WDYT?
@eed3si9n I went with wdyt? I think the "assert" prefix is just noise, but I can live with it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM once it passes Travis
No description provided.