From: Marcel Hollerbach Date: Mon, 7 Jan 2019 17:31:54 +0000 (+0100) Subject: efl_mono: move Eina.Error.Init() to a static constructor X-Git-Tag: submit/tizen/20190128.112154~122 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=150c29b6f43c04ab7e93606af9931f007d7d94d2;p=platform%2Fupstream%2Fefl.git efl_mono: move Eina.Error.Init() to a static constructor this removes the need for the calling a Init function. Reviewed-by: Felipe Magno de Almeida Differential Revision: https://phab.enlightenment.org/D7556 --- diff --git a/src/bindings/mono/eina_mono/eina_config.cs b/src/bindings/mono/eina_mono/eina_config.cs index 87cedaf..ee0bb5b 100644 --- a/src/bindings/mono/eina_mono/eina_config.cs +++ b/src/bindings/mono/eina_mono/eina_config.cs @@ -12,9 +12,6 @@ public class Config { public static void Init() { if (eina_init() == 0) throw (new Efl.EflException("Failed to initialize Eina")); - - // Initialize the submodules here - Eina.Error.Init(); } public static int Shutdown() { diff --git a/src/bindings/mono/eina_mono/eina_error.cs b/src/bindings/mono/eina_mono/eina_error.cs index c2027ae..07760fd 100644 --- a/src/bindings/mono/eina_mono/eina_error.cs +++ b/src/bindings/mono/eina_mono/eina_error.cs @@ -39,7 +39,7 @@ public struct Error : IComparable return "Eina.Error(" + code + ")"; } - internal static void Init() + static Error() { UNHANDLED_EXCEPTION = eina_error_msg_register("Unhandled C# exception occurred."); } diff --git a/src/tests/efl_mono/Errors.cs b/src/tests/efl_mono/Errors.cs index 36b1190..802ac33 100644 --- a/src/tests/efl_mono/Errors.cs +++ b/src/tests/efl_mono/Errors.cs @@ -5,6 +5,10 @@ namespace TestSuite class TestEinaError { + public static void basic_efl_error_available() + { + Test.AssertEquals(Eina.Error.UNHANDLED_EXCEPTION.Message, "Unhandled C# exception occurred."); + } public static void basic_test() { Eina.Error.Clear();