aboutsummaryrefslogtreecommitdiff
path: root/vendor/thiserror/tests/test_backtrace.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2024-07-19 15:37:58 +0300
committerValentin Popov <valentin@popov.link>2024-07-19 15:37:58 +0300
commita990de90fe41456a23e58bd087d2f107d321f3a1 (patch)
tree15afc392522a9e85dc3332235e311b7d39352ea9 /vendor/thiserror/tests/test_backtrace.rs
parent3d48cd3f81164bbfc1a755dc1d4a9a02f98c8ddd (diff)
downloadfparkan-a990de90fe41456a23e58bd087d2f107d321f3a1.tar.xz
fparkan-a990de90fe41456a23e58bd087d2f107d321f3a1.zip
Deleted vendor folder
Diffstat (limited to 'vendor/thiserror/tests/test_backtrace.rs')
-rw-r--r--vendor/thiserror/tests/test_backtrace.rs274
1 files changed, 0 insertions, 274 deletions
diff --git a/vendor/thiserror/tests/test_backtrace.rs b/vendor/thiserror/tests/test_backtrace.rs
deleted file mode 100644
index 4710d45..0000000
--- a/vendor/thiserror/tests/test_backtrace.rs
+++ /dev/null
@@ -1,274 +0,0 @@
-#![cfg_attr(thiserror_nightly_testing, feature(error_generic_member_access))]
-
-use thiserror::Error;
-
-#[derive(Error, Debug)]
-#[error("...")]
-pub struct Inner;
-
-#[cfg(thiserror_nightly_testing)]
-#[derive(Error, Debug)]
-#[error("...")]
-pub struct InnerBacktrace {
- backtrace: std::backtrace::Backtrace,
-}
-
-#[cfg(thiserror_nightly_testing)]
-pub mod structs {
- use super::{Inner, InnerBacktrace};
- use std::backtrace::Backtrace;
- use std::error::{self, Error};
- use std::sync::Arc;
- use thiserror::Error;
-
- #[derive(Error, Debug)]
- #[error("...")]
- pub struct PlainBacktrace {
- backtrace: Backtrace,
- }
-
- #[derive(Error, Debug)]
- #[error("...")]
- pub struct ExplicitBacktrace {
- #[backtrace]
- backtrace: Backtrace,
- }
-
- #[derive(Error, Debug)]
- #[error("...")]
- pub struct OptBacktrace {
- #[backtrace]
- backtrace: Option<Backtrace>,
- }
-
- #[derive(Error, Debug)]
- #[error("...")]
- pub struct ArcBacktrace {
- #[backtrace]
- backtrace: Arc<Backtrace>,
- }
-
- #[derive(Error, Debug)]
- #[error("...")]
- pub struct BacktraceFrom {
- #[from]
- source: Inner,
- #[backtrace]
- backtrace: Backtrace,
- }
-
- #[derive(Error, Debug)]
- #[error("...")]
- pub struct CombinedBacktraceFrom {
- #[from]
- #[backtrace]
- source: InnerBacktrace,
- }
-
- #[derive(Error, Debug)]
- #[error("...")]
- pub struct OptBacktraceFrom {
- #[from]
- source: Inner,
- #[backtrace]
- backtrace: Option<Backtrace>,
- }
-
- #[derive(Error, Debug)]
- #[error("...")]
- pub struct ArcBacktraceFrom {
- #[from]
- source: Inner,
- #[backtrace]
- backtrace: Arc<Backtrace>,
- }
-
- #[derive(Error, Debug)]
- #[error("...")]
- pub struct AnyhowBacktrace {
- #[backtrace]
- source: anyhow::Error,
- }
-
- #[derive(Error, Debug)]
- #[error("...")]
- pub struct BoxDynErrorBacktrace {
- #[backtrace]
- source: Box<dyn Error>,
- }
-
- #[test]
- fn test_backtrace() {
- let error = PlainBacktrace {
- backtrace: Backtrace::capture(),
- };
- assert!(error::request_ref::<Backtrace>(&error).is_some());
-
- let error = ExplicitBacktrace {
- backtrace: Backtrace::capture(),
- };
- assert!(error::request_ref::<Backtrace>(&error).is_some());
-
- let error = OptBacktrace {
- backtrace: Some(Backtrace::capture()),
- };
- assert!(error::request_ref::<Backtrace>(&error).is_some());
-
- let error = ArcBacktrace {
- backtrace: Arc::new(Backtrace::capture()),
- };
- assert!(error::request_ref::<Backtrace>(&error).is_some());
-
- let error = BacktraceFrom::from(Inner);
- assert!(error::request_ref::<Backtrace>(&error).is_some());
-
- let error = CombinedBacktraceFrom::from(InnerBacktrace {
- backtrace: Backtrace::capture(),
- });
- assert!(error::request_ref::<Backtrace>(&error).is_some());
-
- let error = OptBacktraceFrom::from(Inner);
- assert!(error::request_ref::<Backtrace>(&error).is_some());
-
- let error = ArcBacktraceFrom::from(Inner);
- assert!(error::request_ref::<Backtrace>(&error).is_some());
-
- let error = AnyhowBacktrace {
- source: anyhow::Error::msg("..."),
- };
- assert!(error::request_ref::<Backtrace>(&error).is_some());
-
- let error = BoxDynErrorBacktrace {
- source: Box::new(PlainBacktrace {
- backtrace: Backtrace::capture(),
- }),
- };
- assert!(error::request_ref::<Backtrace>(&error).is_some());
- }
-}
-
-#[cfg(thiserror_nightly_testing)]
-pub mod enums {
- use super::{Inner, InnerBacktrace};
- use std::backtrace::Backtrace;
- use std::error;
- use std::sync::Arc;
- use thiserror::Error;
-
- #[derive(Error, Debug)]
- pub enum PlainBacktrace {
- #[error("...")]
- Test { backtrace: Backtrace },
- }
-
- #[derive(Error, Debug)]
- pub enum ExplicitBacktrace {
- #[error("...")]
- Test {
- #[backtrace]
- backtrace: Backtrace,
- },
- }
-
- #[derive(Error, Debug)]
- pub enum OptBacktrace {
- #[error("...")]
- Test {
- #[backtrace]
- backtrace: Option<Backtrace>,
- },
- }
-
- #[derive(Error, Debug)]
- pub enum ArcBacktrace {
- #[error("...")]
- Test {
- #[backtrace]
- backtrace: Arc<Backtrace>,
- },
- }
-
- #[derive(Error, Debug)]
- pub enum BacktraceFrom {
- #[error("...")]
- Test {
- #[from]
- source: Inner,
- #[backtrace]
- backtrace: Backtrace,
- },
- }
-
- #[derive(Error, Debug)]
- pub enum CombinedBacktraceFrom {
- #[error("...")]
- Test {
- #[from]
- #[backtrace]
- source: InnerBacktrace,
- },
- }
-
- #[derive(Error, Debug)]
- pub enum OptBacktraceFrom {
- #[error("...")]
- Test {
- #[from]
- source: Inner,
- #[backtrace]
- backtrace: Option<Backtrace>,
- },
- }
-
- #[derive(Error, Debug)]
- pub enum ArcBacktraceFrom {
- #[error("...")]
- Test {
- #[from]
- source: Inner,
- #[backtrace]
- backtrace: Arc<Backtrace>,
- },
- }
-
- #[test]
- fn test_backtrace() {
- let error = PlainBacktrace::Test {
- backtrace: Backtrace::capture(),
- };
- assert!(error::request_ref::<Backtrace>(&error).is_some());
-
- let error = ExplicitBacktrace::Test {
- backtrace: Backtrace::capture(),
- };
- assert!(error::request_ref::<Backtrace>(&error).is_some());
-
- let error = OptBacktrace::Test {
- backtrace: Some(Backtrace::capture()),
- };
- assert!(error::request_ref::<Backtrace>(&error).is_some());
-
- let error = ArcBacktrace::Test {
- backtrace: Arc::new(Backtrace::capture()),
- };
- assert!(error::request_ref::<Backtrace>(&error).is_some());
-
- let error = BacktraceFrom::from(Inner);
- assert!(error::request_ref::<Backtrace>(&error).is_some());
-
- let error = CombinedBacktraceFrom::from(InnerBacktrace {
- backtrace: Backtrace::capture(),
- });
- assert!(error::request_ref::<Backtrace>(&error).is_some());
-
- let error = OptBacktraceFrom::from(Inner);
- assert!(error::request_ref::<Backtrace>(&error).is_some());
-
- let error = ArcBacktraceFrom::from(Inner);
- assert!(error::request_ref::<Backtrace>(&error).is_some());
- }
-}
-
-#[test]
-#[cfg_attr(not(thiserror_nightly_testing), ignore)]
-fn test_backtrace() {}