Skip to content

Commit dde8dc6

Browse files
authored
chore: Add SentrySdk.CrashedLastRunState to SmokeTester (#2312)
1 parent 344b059 commit dde8dc6

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

test/Scripts.Integration.Test/Scripts/SmokeTester.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using Sentry;
1212
using Sentry.Unity;
1313
using UnityEngine;
14+
using UnityEngine.Diagnostics;
1415
using 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

0 commit comments

Comments
 (0)