[flang-commits] [PATCH] D104011: [Flang][Runtime][tests] Escape regex special character.

Michael Kruse via Phabricator via flang-commits flang-commits at lists.llvm.org
Thu Jun 10 00:20:49 PDT 2021


Meinersbur created this revision.
Meinersbur added reviewers: awarzynski, isuruf, klausler, tskeith, MehdiChinoune, ashermancinelli.
Meinersbur added a project: Flang.
Herald added a subscriber: jdoerfert.
Meinersbur requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The second argument of `ASSERT_DEATH` describes a regular expression, in which parenthesis have special meaning. Matches of literal parentheses need to be escaped.

Fixes failure of InvalidFormatFailure.ParenMismatch and InvalidFormatFailure.ParenMismatch when gtest is compiled with msvc's regex implementation.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104011

Files:
  flang/unittests/RuntimeGTest/Format.cpp


Index: flang/unittests/RuntimeGTest/Format.cpp
===================================================================
--- flang/unittests/RuntimeGTest/Format.cpp
+++ flang/unittests/RuntimeGTest/Format.cpp
@@ -153,7 +153,7 @@
 
   ASSERT_DEATH(
       context.Report(/*edit=*/control.GetNextDataEdit(context, repeat)),
-      "FORMAT missing at least one ')'");
+      R"(FORMAT missing at least one '\)')");
 }
 
 TEST(InvalidFormatFailure, MissingPrecision) {
@@ -166,7 +166,7 @@
 
   ASSERT_DEATH(
       context.Report(/*edit=*/control.GetNextDataEdit(context, repeat)),
-      "Invalid FORMAT: integer expected at ')'");
+      R"(Invalid FORMAT: integer expected at '\)')");
 }
 
 TEST(InvalidFormatFailure, MissingFormatWidth) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104011.351080.patch
Type: text/x-patch
Size: 733 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20210610/7fef4b47/attachment.bin>


More information about the flang-commits mailing list