From f21c7f2d492e909609be9e0f7ba708dc8769a574 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 5 Feb 2020 15:45:26 +0100 Subject: [PATCH] Add a test for C++ comments in code passed to RunScript() This used to be broken, check that it does work now. --- tests/controls/webtest.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/controls/webtest.cpp b/tests/controls/webtest.cpp index 4bcb3ada68..82b5859786 100644 --- a/tests/controls/webtest.cpp +++ b/tests/controls/webtest.cpp @@ -338,6 +338,13 @@ TEST_CASE_METHOD(WebViewTestCase, "WebView", "[wxWebView]") &result)); CHECK(result == "\"2016-10-08T21:30:40.000Z\""); + // Check for C++-style comments which used to be broken. + CHECK(m_browser->RunScript("function f() {\n" + " // A C++ style comment\n" + " return 17;\n" + "}f();", &result)); + CHECK(result == "17"); + // Check for errors too. CHECK(!m_browser->RunScript("syntax(error")); CHECK(!m_browser->RunScript("syntax(error", &result));