From 1b6a04ca5504955c571d1c97504fb45ea0befee4 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Mon, 8 Jan 2024 01:21:28 +0400 Subject: Initial vendor packages Signed-off-by: Valentin Popov --- vendor/thiserror/tests/test_from.rs | 64 +++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 vendor/thiserror/tests/test_from.rs (limited to 'vendor/thiserror/tests/test_from.rs') diff --git a/vendor/thiserror/tests/test_from.rs b/vendor/thiserror/tests/test_from.rs new file mode 100644 index 0000000..51af40b --- /dev/null +++ b/vendor/thiserror/tests/test_from.rs @@ -0,0 +1,64 @@ +#![allow(clippy::extra_unused_type_parameters)] + +use std::io; +use thiserror::Error; + +#[derive(Error, Debug)] +#[error("...")] +pub struct ErrorStruct { + #[from] + source: io::Error, +} + +#[derive(Error, Debug)] +#[error("...")] +pub struct ErrorStructOptional { + #[from] + source: Option, +} + +#[derive(Error, Debug)] +#[error("...")] +pub struct ErrorTuple(#[from] io::Error); + +#[derive(Error, Debug)] +#[error("...")] +pub struct ErrorTupleOptional(#[from] Option); + +#[derive(Error, Debug)] +#[error("...")] +pub enum ErrorEnum { + Test { + #[from] + source: io::Error, + }, +} + +#[derive(Error, Debug)] +#[error("...")] +pub enum ErrorEnumOptional { + Test { + #[from] + source: Option, + }, +} + +#[derive(Error, Debug)] +#[error("...")] +pub enum Many { + Any(#[from] anyhow::Error), + Io(#[from] io::Error), +} + +fn assert_impl>() {} + +#[test] +fn test_from() { + assert_impl::(); + assert_impl::(); + assert_impl::(); + assert_impl::(); + assert_impl::(); + assert_impl::(); + assert_impl::(); +} -- cgit v1.2.3