def test_noexitruntime(self):
    src = '\n      #include <emscripten.h>\n      #include <stdio.h>\n      static int testPre = TEST_PRE;\n      struct Global {\n        Global() {\n          printf("in Global()\\n");\n          if (testPre) { EM_ASM(noExitRuntime = true;); }\n        }\n        ~Global() { printf("ERROR: in ~Global()\\n"); }\n      } global;\n      int main() {\n        if (!testPre) { EM_ASM(noExitRuntime = true;); }\n        printf("in main()\\n");\n      }\n    '
    self.do_run(src.replace('TEST_PRE', '0'), 'in Global()\nin main()')
    self.do_run(src.replace('TEST_PRE', '1'), 'in Global()\nin main()')
def test_noexitruntime(self):
    src = '\n      #include <emscripten.h>\n      #include <stdio.h>\n      static int testPre = TEST_PRE;\n      struct Global {\n        Global() {\n          printf("in Global()\\n");\n          if (testPre) { EM_ASM(noExitRuntime = true;); }\n        }\n        ~Global() { printf("ERROR: in ~Global()\\n"); }\n      } global;\n      int main() {\n        if (!testPre) { EM_ASM(noExitRuntime = true;); }\n        printf("in main()\\n");\n      }\n    '
    self.do_run(src.replace('TEST_PRE', '0'), 'in Global()\nin main()')
    self.do_run(src.replace('TEST_PRE', '1'), 'in Global()\nin main()')