File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
test/Scripts.Integration.Test/Scripts Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 1111using Sentry ;
1212using Sentry . Unity ;
1313using UnityEngine ;
14+ using UnityEngine . Diagnostics ;
1415using Debug = UnityEngine . Debug ;
1516
1617#if UNITY_WEBGL
@@ -200,7 +201,7 @@ public static void CrashTest()
200201 AddContext ( ) ;
201202
202203 Debug . Log ( "CRASH TEST: Issuing a native crash (c++ unhandled exception)" ) ;
203- throw_cpp ( ) ;
204+ Utils . ForceCrash ( ForcedCrashCategory . FatalError ) ;
204205
205206 // shouldn't execute because the previous call should have failed
206207 Debug . Log ( "CRASH TEST: FAIL - unexpected code executed..." ) ;
@@ -212,6 +213,10 @@ public static void HasntCrashedTest()
212213 t . Start ( "HASNT-CRASHED" ) ;
213214 var crashed = CrashedLastRun ( ) ;
214215 t . Expect ( $ "options.CrashedLastRun ({ crashed } ) == false (0)", crashed == 0 ) ;
216+
217+ var lastRunState = SentrySdk . GetLastRunState ( ) ;
218+ t . Expect ( $ "SentrySdk.GetLastRunState() ({ lastRunState } ) is 'DidNotCrash'", lastRunState == SentrySdk . CrashedLastRun . DidNotCrash ) ;
219+
215220 t . Pass ( ) ;
216221 }
217222
@@ -220,6 +225,10 @@ public static void HasCrashedTest()
220225 t . Start ( "HAS-CRASHED" ) ;
221226 var crashed = CrashedLastRun ( ) ;
222227 t . Expect ( $ "options.CrashedLastRun ({ crashed } ) == true (1)", crashed == 1 ) ;
228+
229+ var lastRunState = SentrySdk . GetLastRunState ( ) ;
230+ t . Expect ( $ "SentrySdk.GetLastRunState() ({ lastRunState } ) is 'Crashed'", lastRunState == SentrySdk . CrashedLastRun . Crashed ) ;
231+
223232 t . Pass ( ) ;
224233 }
225234
You can’t perform that action at this time.
0 commit comments