-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add exception handling test (currently failing).
- Loading branch information
Showing
7 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Reinterop; | ||
|
||
namespace CesiumForUnity | ||
{ | ||
/// <summary> | ||
/// Internal helpers for testing Reinterop functionality. | ||
/// </summary> | ||
[ReinteropNativeImplementation("CesiumForUnityNative::TestReinteropImpl", "TestReinteropImpl.h", true)] | ||
internal partial class TestReinterop | ||
{ | ||
public partial bool CallThrowAnExceptionFromCpp(); | ||
|
||
public static void ThrowAnException() | ||
{ | ||
throw new System.Exception("Test Exception!"); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using NUnit.Framework; | ||
|
||
public class TestReinterop | ||
{ | ||
[Test] | ||
public void TestADotNetExceptionCanBeCaughtInCpp() | ||
{ | ||
CesiumForUnity.TestReinterop o = new CesiumForUnity.TestReinterop(); | ||
Assert.IsTrue(o.CallThrowAnExceptionFromCpp()); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include "TestReinteropImpl.h" | ||
|
||
#include <DotNet/CesiumForUnity/TestReinterop.h> | ||
|
||
namespace CesiumForUnityNative { | ||
|
||
bool TestReinteropImpl::CallThrowAnExceptionFromCpp( | ||
const DotNet::CesiumForUnity::TestReinterop& instance) { | ||
try { | ||
instance.ThrowAnException(); | ||
} catch (...) { | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
} // namespace CesiumForUnityNative |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#pragma once | ||
|
||
#include <CesiumImpl.h> | ||
|
||
namespace DotNet::CesiumForUnity { | ||
class TestReinterop; | ||
} | ||
|
||
namespace CesiumForUnityNative { | ||
|
||
class TestReinteropImpl { | ||
public: | ||
static bool CallThrowAnExceptionFromCpp( | ||
const DotNet::CesiumForUnity::TestReinterop& instance); | ||
}; | ||
|
||
} // namespace CesiumForUnityNative |