1 extern crate backtrace
;
3 #[cfg(all(windows, feature = "dbghelp"))]
6 use backtrace
::Backtrace
;
8 // 50-character module name
9 mod _234567890_234567890_234567890_234567890_234567890
{
10 // 50-character struct name
11 #[allow(non_camel_case_types)]
12 pub struct _234567890_234567890_234567890_234567890_234567890
<T
>(T
);
13 impl<T
> _234567890_234567890_234567890_234567890_234567890
<T
> {
15 pub fn new() -> ::Backtrace
{
21 // Long function names must be truncated to (MAX_SYM_NAME - 1) characters.
22 // Only run this test for msvc, since gnu prints "<no info>" for all frames.
24 #[cfg(all(windows, feature = "dbghelp", target_env = "msvc"))]
25 fn test_long_fn_name() {
26 use _234567890_234567890_234567890_234567890_234567890
::
27 _234567890_234567890_234567890_234567890_234567890
as S
;
29 // 10 repetitions of struct name, so fully qualified function name is
30 // atleast 10 * (50 + 50) * 2 = 2000 characters long.
31 // It's actually longer since it also includes `::`, `<>` and the
32 // name of the current module
33 let bt
= S
::<S
<S
<S
<S
<S
<S
<S
<S
<S
<i32>>>>>>>>>>::new();
36 let mut found_long_name_frame
= false;
38 for frame
in bt
.frames() {
39 let symbols
= frame
.symbols();
40 if symbols
.is_empty() {
44 if let Some(function_name
) = symbols
[0].name() {
45 let function_name
= function_name
.as_str().unwrap();
46 if function_name
.contains(
47 "::_234567890_234567890_234567890_234567890_234567890")
49 found_long_name_frame
= true;
50 assert_eq
!(function_name
.len(), winapi
::MAX_SYM_NAME
- 1);
55 assert
!(found_long_name_frame
);