Comments (10)
That error happens when the value that is panicked doesn't implement the Debug
trait. I'm not sure what exactly is causing the panic, but you have a few options:
- QuickCheck is actually giving you more information. In particular, it's telling your the arguments used that caused the failure (this is the "witness"):
Arguments: ([0])
. - You may have more luck by setting the environment variable
RUST_BACKTRACE=1
when runningcargo test
. The key will be to look for the backtraces produced as part of the panic while tests are running. Right now, they appear as this in your build output:thread 'safe' panicked at 'called
Option::unwrap()on a
Nonevalue', ../src/libcore/option.rs:362
.
from quickcheck.
I ended up finding the bug with the backtrace option (thanks!), but I am still unsure why Quickcheck was not able to print the value. The value that panicked was an Option<i32>
... however, in the context, it was generic (A value of Option<T> where T: Ord + Clone + Debug + Arbitrary
). Either way, thanks for the help.
from quickcheck.
Strange. This is the relevant code: https://github.com/BurntSushi/quickcheck/blob/master/src/tester.rs#L409-L419
I'll leave this open. Ideally, we could get a smaller test case that is easier to debug.
from quickcheck.
match any_err.downcast_ref::<&Debug>()
is very “optimistic”. Downcasting an Any is only possible to the exact type that was packaged up into the Any
.
from quickcheck.
Right, it basically never works. Are we SOL here? Or is there some other way to show the panic? If most panics are strings, then maybe we should try &str
and String
too.
from quickcheck.
I think it's basically impossible to literally satisfy &Debug
(that would require panicking with a &'static Debug
trait object), so it just make sense to try &str
and String
, which should cover typical panics, including those from the assert*
macros. I guess it doesn't cost much to also check fancier things like Box<Debug>
but they seem very unlikely to be triggered.
from quickcheck.
Any updates on this issue? I am running into lots of "UNABLE TO SHOW RESULT OF PANIC."
messages and it is hiding the cause of the panics in my code.
from quickcheck.
Sure, I have posted a PR to fix. Depends on the resolution of shrinking prs first though.
from quickcheck.
@yggie Do you have interesting nonstandard panics? My fix only handles &str and String cases, which should be all assertions and all panics that use strings as the message.
from quickcheck.
@bluss I don’t do anything special with panics, I send &str
most of the time, so that would solve my problem!
from quickcheck.
Related Issues (20)
- Identity checking HOT 3
- Stack overflow in quickcheck case shrinking HOT 3
- example case sort TEST FAILED HOT 1
- QuickChecking Const Generic Code HOT 5
- Implement Arbitrary for AsMut<[T: Arbitrary]> HOT 2
- Infinite Repetition/Never Ending Test with `f32` and `f64`. HOT 17
- Q: Idiomatic way to specify the length of an arbitrary vector HOT 7
- <newbie> How to generate a number within a range HOT 2
- Negating an integer leads to stack overflow HOT 2
- upgrade notes would be nice. HOT 1
- debug_reprs taking up 41% of test runtime HOT 2
- warning: panic message is not a string literal HOT 1
- Rng Size for Vec Arbitrary cannot be 0
- Impl Clone for Gen
- Implement something like choose_weighted for `Gen`
- Is this still maintained? HOT 1
- Is quickcheck still maintained? HOT 1
- How to combine quickcheck 1+ with fake? HOT 3
- Durations's Arbitrary instance is dependant on Gen's size HOT 1
- `Logging` not working on `quickcheck` test. 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 quickcheck.