mbeckerle commented on a change in pull request #394:
URL: https://github.com/apache/incubator-daffodil/pull/394#discussion_r455098824
##########
File path: project/Dependencies.scala
##########
@@ -29,6 +29,7 @@ object Dependencies {
"xml-resolver" % "xml-resolver" % "1.2",
"commons-io" % "commons-io" % "2.6",
"jline" % "jline" % "2.14.6",
+ "org.scalatest" %% "scalatest" % "3.2.0" % "test"
Review comment:
I would go farther than this. I really hate scalatest. It is a pointless
DSL that enables English-centric people to use English-centric sentence
structure words like "should" which is unnatural in other languages (words like
should become verb conjugation in some languages), to express tests. This is
unfriendly to non-native English speakers.
I think scalatest primarily serves as an example of how to program DSLs in
scala. As a test rig itself it's unnecessary, and in fact problematic.
It encourages tests to contain text strings that are for reporting purposes,
but those strings must be kept consistent with the test itself.
It is better to just choose a good name for the test method and test class.
This is from the scalatest web page. I've added my comments:
```
class ExampleSpec extends AnyFlatSpec with should.Matchers {
"A Stack" should "pop values in last-in-first-out order" in {
//
// This English-centric phrasing has no advantage over @Test def
stackShouldPopInLIFOOrder()
//
val stack = new Stack[Int]
stack.push(1)
stack.push(2)
stack.pop() should be (2)
stack.pop() should be (1)
}
it should "throw NoSuchElementException if an empty stack is popped" in {
//
// it? Referring to what? "A Stack" is conveniently right there above in
this toy example.
// In real code it could be off screen scrolled away. This is not a
strength of natural language we
// want to pull into formal language.
//
// The above also repeats the exception name which is 100% redundant and
as that string is just for a report,
// it can become inconsistent with the way the test evolves if the
exception thrown is changed.
val emptyStack = new Stack[Int]
a [NoSuchElementException] should be thrownBy {
emptyStack.pop()
}
//
// This has no advantage over @Test def stackThrowsProperException() ....
//
}
}
```
I think scalatest primarily serves as an example of how to program DSLs in
scala. As a test rig itself it's unnecessary, and in fact problematic.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]