]> granicus.if.org Git - esp-idf/commitdiff
cxx: Add a sanity check for C++ exception support
authorAngus Gratton <angus@espressif.com>
Wed, 4 Oct 2017 05:00:11 +0000 (16:00 +1100)
committerAngus Gratton <gus@projectgus.com>
Tue, 17 Oct 2017 06:46:08 +0000 (14:46 +0800)
components/cxx/test/test_cxx.cpp

index 7e08e9017e40cf33a87b1ed34c72bcadeaa7c45d..af73d9ea9210e44d64ad8d1bb89f28c35cfc2a5a 100644 (file)
@@ -188,6 +188,21 @@ TEST_CASE("before scheduler has started, static initializers work correctly", "[
     TEST_ASSERT_EQUAL(2, StaticInitTestBeforeScheduler::order);
 }
 
+TEST_CASE("c++ exceptions work", "[cxx]")
+{
+    int thrown_value;
+    try
+    {
+        throw 20;
+    }
+    catch (int e)
+    {
+        thrown_value = e;
+    }
+    TEST_ASSERT_EQUAL(20, thrown_value);
+    printf("OK?\n");
+}
+
 /* These test cases pull a lot of code from libstdc++ and are disabled for now
  */
 #if 0