Giter Site home page Giter Site logo

Comments (10)

BurntSushi avatar BurntSushi commented on August 11, 2024

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:

  1. 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]).
  2. You may have more luck by setting the environment variable RUST_BACKTRACE=1 when running cargo 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 'calledOption::unwrap()on aNonevalue', ../src/libcore/option.rs:362.

from quickcheck.

kazagistar avatar kazagistar commented on August 11, 2024

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.

BurntSushi avatar BurntSushi commented on August 11, 2024

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.

bluss avatar bluss commented on August 11, 2024

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.

BurntSushi avatar BurntSushi commented on August 11, 2024

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.

huonw avatar huonw commented on August 11, 2024

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.

yggie avatar yggie commented on August 11, 2024

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.

bluss avatar bluss commented on August 11, 2024

Sure, I have posted a PR to fix. Depends on the resolution of shrinking prs first though.

from quickcheck.

bluss avatar bluss commented on August 11, 2024

@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.

yggie avatar yggie commented on August 11, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.