From dd235d5ded878ace99ac89d32d55651aeaf6cee5 Mon Sep 17 00:00:00 2001 From: Junji Hashimoto Date: Fri, 29 Sep 2023 05:35:10 +0900 Subject: [PATCH] Remove 'error: control reaches end of non-void function' of C++ --- inline-c-cpp/test/tests.hs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/inline-c-cpp/test/tests.hs b/inline-c-cpp/test/tests.hs index 1474f7f..ab8ce1d 100644 --- a/inline-c-cpp/test/tests.hs +++ b/inline-c-cpp/test/tests.hs @@ -298,19 +298,20 @@ main = Hspec.hspec $ do {- Manual test cases for testing lineDirective and splitTypedC -- For CI, uncomment this line. Hspec.it "error reporting test case" $ do - result <- try $ [C.throwBlock| int { 0 = 0; /* Test this line. */}|] + result <- try $ [C.throwBlock| int { 0 = 0; return 0xDEADBEEF; /* Test this line. */}|] result `shouldBeRight` 0xDEADBEEF Hspec.it "error reporting test case" $ do result <- try $ [C.throwBlock| int - { 1 = 1; /* Test this line. */} + { 1 = 1; return 0xDEADBEEF; /* Test this line. */} |] result `shouldBeRight` 0xDEADBEEF Hspec.it "error reporting test case" $ do result <- try $ [C.throwBlock| int { - 2 = 2; /* Test this line. */ + 2 = 2; /* Test this line. */ + return 0xDEADBEEF; } |] result `shouldBeRight` 0xDEADBEEF @@ -320,6 +321,7 @@ main = Hspec.hspec $ do int { 3 = 3; /* Test this line. */ + return 0xDEADBEEF; } |] result `shouldBeRight` 0xDEADBEEF @@ -330,6 +332,7 @@ main = Hspec.hspec $ do int { 4 = 4; /* Test this line. */ + return 0xDEADBEEF; } |] result `shouldBeRight` 0xDEADBEEF