Codebase list rust-libslirp / cb4ee4d
snafu - fix tests with --no-default-features. Peter Michael Green 1 year, 10 months ago
3 changed file(s) with 363 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
00 rust-snafu (0.7.1-1) UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO; urgency=medium
11
22 * Team upload.
3 * Package snafu 0.7.1 from crates.io using debcargo 2.5.0 (Closes: #1013780)
3 * Package snafu 0.7.1 from crates.io using debcargo 2.5.0
44 * Drop fix-test-backtrace-env-var-assumption.diff, merged upstream.
5 * Fix tests with --no-default-features
56
6 -- Peter Michael Green <plugwash@debian.org> Mon, 27 Jun 2022 21:38:23 +0000
7 -- Peter Michael Green <plugwash@debian.org> Tue, 28 Jun 2022 00:50:32 +0000
78
89 rust-snafu (0.6.10-1) unstable; urgency=medium
910
0 Index: snafu/tests/backtrace-optional-enabled.rs
1 ===================================================================
2 --- snafu.orig/tests/backtrace-optional-enabled.rs
3 +++ snafu/tests/backtrace-optional-enabled.rs
4 @@ -1,3 +1,4 @@
5 +#![cfg(feature="std")]
6 use snafu::{prelude::*, Backtrace, ErrorCompat};
7
8 #[derive(Debug, Snafu)]
9 Index: snafu/tests/backtrace-optional.rs
10 ===================================================================
11 --- snafu.orig/tests/backtrace-optional.rs
12 +++ snafu/tests/backtrace-optional.rs
13 @@ -1,3 +1,4 @@
14 +#![cfg(feature="std")]
15 use snafu::{prelude::*, Backtrace, ErrorCompat};
16
17 #[derive(Debug, Snafu)]
18 Index: snafu/tests/backtrace.rs
19 ===================================================================
20 --- snafu.orig/tests/backtrace.rs
21 +++ snafu/tests/backtrace.rs
22 @@ -1,3 +1,4 @@
23 +#![cfg(feature="std")]
24 use snafu::{prelude::*, Backtrace, ErrorCompat};
25
26 type AnotherError = Box<dyn std::error::Error>;
27 Index: snafu/tests/backtrace_attributes.rs
28 ===================================================================
29 --- snafu.orig/tests/backtrace_attributes.rs
30 +++ snafu/tests/backtrace_attributes.rs
31 @@ -1,3 +1,4 @@
32 +#![cfg(feature="std")]
33 use snafu::{prelude::*, Backtrace};
34
35 #[derive(Debug, Snafu)]
36 Index: snafu/tests/basic.rs
37 ===================================================================
38 --- snafu.orig/tests/basic.rs
39 +++ snafu/tests/basic.rs
40 @@ -1,3 +1,4 @@
41 +#![cfg(feature="std")]
42 use snafu::prelude::*;
43 use std::{
44 fs, io,
45 Index: snafu/tests/boxed_error_trait_object.rs
46 ===================================================================
47 --- snafu.orig/tests/boxed_error_trait_object.rs
48 +++ snafu/tests/boxed_error_trait_object.rs
49 @@ -34,6 +34,7 @@ mod trait_object_send_sync {
50 }
51 }
52
53 +#[cfg(feature="std")]
54 #[derive(Debug, Snafu)]
55 enum Error {
56 TraitObject {
57 @@ -57,6 +58,7 @@ enum Error {
58 },
59 }
60
61 +#[cfg(feature="std")]
62 fn example() -> Result<(), Error> {
63 trait_object::function().context(TraitObjectSnafu { user_id: 42 })?;
64 trait_object_send::function().context(TraitObjectSendSnafu { user_id: 42 })?;
65 @@ -66,6 +68,7 @@ fn example() -> Result<(), Error> {
66 Ok(())
67 }
68
69 +#[cfg(feature="std")]
70 #[test]
71 fn implements_error() {
72 fn check<T: std::error::Error>() {}
73 Index: snafu/tests/build-leaf-error.rs
74 ===================================================================
75 --- snafu.orig/tests/build-leaf-error.rs
76 +++ snafu/tests/build-leaf-error.rs
77 @@ -15,6 +15,7 @@ fn map_result() -> Result<i32> {
78 other_result().map_err(|_| MineSnafu.build())
79 }
80
81 +#[cfg(feature="std")]
82 #[test]
83 fn implements_error() {
84 fn check<T: std::error::Error>() {}
85 Index: snafu/tests/context_selector_name.rs
86 ===================================================================
87 --- snafu.orig/tests/context_selector_name.rs
88 +++ snafu/tests/context_selector_name.rs
89 @@ -23,6 +23,7 @@ fn no_suffix_usage() -> Result<(), Error
90 CanOptOutOfSuffix.fail()
91 }
92
93 +#[cfg(feature="std")]
94 #[test]
95 fn implements_error() {
96 fn check<T: std::error::Error>() {}
97 @@ -57,6 +58,7 @@ mod applied_to_enum {
98 GammaCow.fail()
99 }
100
101 + #[cfg(feature="std")]
102 #[test]
103 fn implements_error() {
104 fn check<T: std::error::Error>() {}
105 Index: snafu/tests/doc_comment.rs
106 ===================================================================
107 --- snafu.orig/tests/doc_comment.rs
108 +++ snafu/tests/doc_comment.rs
109 @@ -16,6 +16,7 @@ enum Error {
110 Hidden,
111 }
112
113 +#[cfg(feature="std")]
114 #[test]
115 fn implements_error() {
116 fn check<T: std::error::Error>() {}
117 Index: snafu/tests/error_chain.rs
118 ===================================================================
119 --- snafu.orig/tests/error_chain.rs
120 +++ snafu/tests/error_chain.rs
121 @@ -26,6 +26,7 @@ fn assert_eq_debug(a: impl Debug, b: imp
122 assert_eq!(format!("{:?}", a), format!("{:?}", b));
123 }
124
125 +#[cfg(feature="std")]
126 #[test]
127 fn chain_compat_iterates() {
128 use snafu::{ChainCompat, IntoError};
129 @@ -41,6 +42,7 @@ fn chain_compat_iterates() {
130 assert_eq_debug(&errors[2], &bottom_error);
131 }
132
133 +#[cfg(feature="std")]
134 #[test]
135 fn errorcompat_chain_iterates() {
136 use snafu::{ErrorCompat, IntoError};
137 Index: snafu/tests/generics.rs
138 ===================================================================
139 --- snafu.orig/tests/generics.rs
140 +++ snafu/tests/generics.rs
141 @@ -1,3 +1,4 @@
142 +#![cfg(feature="std")]
143 use snafu::{prelude::*, Backtrace};
144
145 type BoxError = Box<dyn std::error::Error>;
146 Index: snafu/tests/generics_with_default.rs
147 ===================================================================
148 --- snafu.orig/tests/generics_with_default.rs
149 +++ snafu/tests/generics_with_default.rs
150 @@ -1,3 +1,4 @@
151 +#[cfg(feature="std")]
152 mod default_with_lifetime {
153 use snafu::{prelude::*, AsErrorSource};
154 use std::fmt::{Debug, Display};
155 Index: snafu/tests/location.rs
156 ===================================================================
157 --- snafu.orig/tests/location.rs
158 +++ snafu/tests/location.rs
159 @@ -1,3 +1,4 @@
160 +#![cfg(all(feature="rust_1_46",feature="std"))]
161 use snafu::{prelude::*, Location};
162
163 mod basics {
164 @@ -14,8 +15,8 @@ mod basics {
165 let one = UsageSnafu.build();
166 let two = UsageSnafu.build();
167
168 - assert_eq!(one.to_string(), "Created at tests/location.rs:14:30");
169 - assert_eq!(two.to_string(), "Created at tests/location.rs:15:30");
170 + assert_eq!(one.to_string(), "Created at tests/location.rs:15:30");
171 + assert_eq!(two.to_string(), "Created at tests/location.rs:16:30");
172 }
173 }
174
175 @@ -60,6 +61,7 @@ mod track_caller {
176 location: Location,
177 }
178
179 + #[cfg(feature="std")]
180 #[derive(Debug, Snafu)]
181 #[snafu(display("{}", message))]
182 #[snafu(whatever)]
183 @@ -110,6 +112,7 @@ mod track_caller {
184 );
185 }
186
187 + #[cfg(feature="std")]
188 #[test]
189 fn track_caller_is_applied_on_whatever() {
190 let base_line = line!();
191 Index: snafu/tests/no_context.rs
192 ===================================================================
193 --- snafu.orig/tests/no_context.rs
194 +++ snafu/tests/no_context.rs
195 @@ -1,3 +1,4 @@
196 +#![cfg(feature="std")]
197 use snafu::prelude::*;
198
199 #[derive(Debug, Snafu)]
200 Index: snafu/tests/opaque.rs
201 ===================================================================
202 --- snafu.orig/tests/opaque.rs
203 +++ snafu/tests/opaque.rs
204 @@ -13,6 +13,7 @@ mod inner {
205 Ok(value)
206 }
207
208 + #[cfg(feature="std")]
209 pub fn boxed_inner(value: i32) -> Result<i32, Box<dyn std::error::Error>> {
210 ensure!(value < 1, TooBigSnafu { count: value });
211 Ok(value)
212 @@ -33,6 +34,7 @@ mod inner {
213 }
214 }
215
216 +#[cfg(feature="std")]
217 #[test]
218 fn implements_error() {
219 fn check<T: std::error::Error>() {}
220 @@ -49,6 +51,7 @@ fn ensure_opaque() {
221 assert!(e.to_string().contains("too big"));
222 }
223
224 +#[cfg(feature="std")]
225 #[test]
226 fn ensure_boxed() {
227 assert!(inner::boxed_inner(-1).is_ok());
228 Index: snafu/tests/options.rs
229 ===================================================================
230 --- snafu.orig/tests/options.rs
231 +++ snafu/tests/options.rs
232 @@ -22,6 +22,7 @@ fn example(values: &HashMap<i32, i32>, l
233 Ok(l + r)
234 }
235
236 +#[cfg(feature="std")]
237 #[test]
238 fn implements_error() {
239 fn check<T: std::error::Error>() {}
240 Index: snafu/tests/premade_error.rs
241 ===================================================================
242 --- snafu.orig/tests/premade_error.rs
243 +++ snafu/tests/premade_error.rs
244 @@ -1,3 +1,4 @@
245 +#![cfg(feature="std")]
246 use snafu::{prelude::*, Whatever};
247
248 type Result<T, E = Whatever> = std::result::Result<T, E>;
249 Index: snafu/tests/raw_idents.rs
250 ===================================================================
251 --- snafu.orig/tests/raw_idents.rs
252 +++ snafu/tests/raw_idents.rs
253 @@ -13,6 +13,7 @@ enum Error {
254
255 type Result<T, E = Error> = std::result::Result<T, E>;
256
257 +#[cfg(feature="std")]
258 #[test]
259 fn implements_error() {
260 fn check<T: std::error::Error>() {}
261 Index: snafu/tests/recursive_error.rs
262 ===================================================================
263 --- snafu.orig/tests/recursive_error.rs
264 +++ snafu/tests/recursive_error.rs
265 @@ -1,3 +1,4 @@
266 +#![cfg(feature="std")]
267 use snafu::prelude::*;
268
269 #[derive(Debug, Snafu)]
270 Index: snafu/tests/send_between_threads.rs
271 ===================================================================
272 --- snafu.orig/tests/send_between_threads.rs
273 +++ snafu/tests/send_between_threads.rs
274 @@ -1,3 +1,4 @@
275 +#![cfg(feature="std")]
276 // This test asserts that errors can be used across threads.
277
278 use std::thread;
279 Index: snafu/tests/source_attributes.rs
280 ===================================================================
281 --- snafu.orig/tests/source_attributes.rs
282 +++ snafu/tests/source_attributes.rs
283 @@ -1,3 +1,4 @@
284 +#![cfg(feature="std")]
285 use snafu::prelude::*;
286
287 #[derive(Debug, Snafu)]
288 Index: snafu/tests/stringly_typed.rs
289 ===================================================================
290 --- snafu.orig/tests/stringly_typed.rs
291 +++ snafu/tests/stringly_typed.rs
292 @@ -1,6 +1,6 @@
293 // TODO: ensure no-std still works
294 // THOUGHT: Source must always be an `Option`. This seems to force the `from()`
295 -
296 +#![cfg(feature="std")]
297 mod message_only {
298 use snafu::prelude::*;
299
300 @@ -205,6 +205,7 @@ mod message_source_and_backtrace {
301 }
302 }
303
304 +#[cfg(feature="std")]
305 mod struck {
306 mod message_source_and_backtrace {
307 use snafu::{prelude::*, Backtrace};
308 Index: snafu/tests/structs/generics.rs
309 ===================================================================
310 --- snafu.orig/tests/structs/generics.rs
311 +++ snafu/tests/structs/generics.rs
312 @@ -29,6 +29,7 @@ mod types {
313 assert_eq!(e.key, key);
314 }
315
316 + #[cfg(feature="std")]
317 mod with_defaults {
318 use snafu::{prelude::*, AsErrorSource};
319 use std::{error::Error as StdError, fmt::Debug, io};
320 Index: snafu/tests/structs/context_selector_name.rs
321 ===================================================================
322 --- snafu.orig/tests/structs/context_selector_name.rs
323 +++ snafu/tests/structs/context_selector_name.rs
324 @@ -1,3 +1,4 @@
325 +#![cfg(feature="std")]
326 use snafu::prelude::*;
327
328 #[derive(Debug, Snafu)]
329 Index: snafu/tests/structs/source_attributes.rs
330 ===================================================================
331 --- snafu.orig/tests/structs/source_attributes.rs
332 +++ snafu/tests/structs/source_attributes.rs
333 @@ -48,6 +48,7 @@ mod enabling {
334 }
335 }
336
337 +#[cfg(feature="std")]
338 mod transformation {
339 use super::*;
340 use std::{error::Error as StdError, io};
341 Index: snafu/tests/structs/with_source.rs
342 ===================================================================
343 --- snafu.orig/tests/structs/with_source.rs
344 +++ snafu/tests/structs/with_source.rs
345 @@ -1,3 +1,4 @@
346 +#![cfg(feature="std")]
347 use snafu::prelude::*;
348 use std::{
349 error::Error as StdError,
350 Index: snafu/tests/structs/without_source.rs
351 ===================================================================
352 --- snafu.orig/tests/structs/without_source.rs
353 +++ snafu/tests/structs/without_source.rs
354 @@ -1,3 +1,4 @@
355 +#![cfg(feature="std")]
356 use snafu::prelude::*;
357 use std::error::Error as StdError;
358
0 fix-tests-no-default-features.patch