forked from ldc-developers/ldc
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexception_stack_trace.d
More file actions
38 lines (34 loc) · 905 Bytes
/
exception_stack_trace.d
File metadata and controls
38 lines (34 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// RUN: %ldc -g %s -of=%t%exe
// RUN: %t%exe | FileCheck %s
void bar()
{
throw new Exception("lala");
}
void foo()
{
bar();
}
void main()
{
try
{
foo();
}
catch (Exception e)
{
import core.stdc.stdio;
auto s = e.toString();
printf("%.*s\n", cast(int) s.length, s.ptr);
}
}
// CHECK: object.Exception@{{.*}}exception_stack_trace.d(6): lala
// CHECK-NEXT: ----------------
/* Hiding all frames up to and including the first _d_throw_exception()
* one doesn't work reliably on all platforms, so don't enforce
* CHECK-*NEXT* for the bar() frame.
* On Win32, the bar() frame is missing altogether.
* So be very generous and only check for 2 consecutive lines containing
* 'exception_stack_trace' each (in function name and/or source file).
*/
// CHECK: exception_stack_trace{{.*$}}
// CHECK-NEXT: exception_stack_trace{{.*$}}