File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
engine/Sandbox.Test/Editor Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 1+ using System . Reflection ;
2+ using System . Text . RegularExpressions ;
3+ using Editor ;
4+
5+ namespace TestEditor ;
6+
7+ [ TestClass ]
8+ public class StackTraceTests
9+ {
10+ [ TestMethod ]
11+ [ DataRow ( @"at Example.Foo() in C:\sbox\Source.cs:line 123" , true ) ]
12+ [ DataRow ( @"cat Example.Foo() in C:\sbox\Source.cs:line 123" , false ) ]
13+ [ DataRow ( @"at Error in something in C:\sbox\Source.cs:line 123" , true ) ]
14+ public void DefaultStackLine ( string line , bool expectMatch )
15+ {
16+ var isMatch = GetDefaultStackLineHandlerRegex ( ) . Match ( line ) ;
17+
18+ Assert . AreEqual ( expectMatch , isMatch . Success ) ;
19+ }
20+
21+ private Regex GetDefaultStackLineHandlerRegex ( )
22+ {
23+ var method = typeof ( StackTraceProperty ) . GetMethod ( nameof ( StackTraceProperty . DefaultStackLineHandler ) , BindingFlags . Static | BindingFlags . Public ) ! ;
24+
25+ return new Regex ( method . GetCustomAttribute < StackLineHandlerAttribute > ( ) ! . Regex ) ;
26+ }
27+ }
You can’t perform that action at this time.
0 commit comments