Comments (5)
Hi Tobias,
Sorry I only today noticed this issue. The problem is actually that you put your assertion in a "scope" not a "test". This is unfortunately not a type error, and unfortunately the error message you get in the exception doesn't seem to give much clue. I think what I'll do for the next release is try and give a better hint in the error message. I'll also look at ways to make this kind of error a compile-time error.
Anyway, in a FreeSpec "scopes" are introduced with a dash (-) and "tests" are introduced with "in". Scopes are a way to group tests. Although the bodies of the tests are registered at construction time for later execution, the bodies of scopes are evaluated at construction time. That means in this case your assertions execute at construction time, and when they fail, it means ScalaTest can't instantiate the Suite and so the run aborts. To fix it you can just change the "-" to an "in".
from scalatest.
Thanks for you explanation. Unfortunately, I'm not quite sure I understand it. You said, the assert is not in a "test", but actually, it is surrounded by a "string" in { .. }
construct. Also, the assert will not throw an exception in the case the code is right, but still I see this issue.
Why I can get rid of the exception, when I delete the toString()
override in the class under test?
Also, if I remove the third of these test cases (constructed with the mergeTest
function, so my understanding is, it is a "test") all other tests run well. Even if I now modify the class under test so that it produces incorrect results, I still get a proper test run outlining the successful ran and the failed tests.
from scalatest.
Sorry, I didn't notice the "in". This one is back in action.
from scalatest.
Ah, duplicate test name exception was being thrown!
from scalatest.
Thank you Bill for taking the time (live @ ScalaDays) to look into this!
(The strange three cases from the original issue (overridden toString
, removed feature, removed test case) all influenced the titles of the tests and thus implicitly avoided the duplication.)
from scalatest.
Related Issues (20)
- Opaque Types don't verify correctly (Maybe ?) HOT 6
- FBounded Polymorphism and `shouldNot compile` giving a false positive HOT 6
- WordSpecLike HOT 3
- Passing position explicitly to test in Scala 3 HOT 5
- Need support for com.vladsch.flexmark:[email protected] HOT 3
- Retry test with delay HOT 5
- assertDoesNotCompile not works when creating mixins HOT 4
- StackDepthException.failedCodeStackDepth returns invalid value `0` when using Future + passing custom implicit position HOT 4
- Passing assert message by-name? HOT 3
- Unexpected compilation warnings: Auto-application to `()` is deprecated. HOT 5
- PrivateMethodTester does not correctly honor type bounds for method arguments HOT 1
- only method not working in Scala 3 Matchers (as List) HOT 1
- InsertionOrderSet performance issue HOT 5
- what's the right way to use scalatest with scalatestplus.junit5? HOT 2
- add back Mockito 4 support? HOT 3
- Shell.run doesn't fail, it would be nice if it could HOT 2
- Execute tasks on SerialExecutionContext outside of a test HOT 1
- Publish artifacts for Scala-Native 0.5.0? HOT 4
- === method causes conflict in Scala 3
- ScalaTest all release jar files are empty and file size is 1kb HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scalatest.