test: Improve regex in Swift feature usage verification script

* Account for variable number of spaces.
* Match strings like '-enable-upcoming-feature\'. We want to complain
  about these because the script cannot get the job done when the option
  and argument are on different lines.
  The capture group will match '' in these cases.
This commit is contained in:
Anthony Latsis
2025-03-03 11:04:47 +00:00
parent 986f1d40e5
commit 64dcce31a3

View File

@@ -28,7 +28,7 @@ EXCEPTIONAL_FILES = [
]
ENABLE_FEATURE_RE = re.compile(
r"-enable-(?:experimental|upcoming)-feature (?:-Xfrontend )?([A-Za-z0-9]*)"
r"-enable-(?:experimental|upcoming)-feature(?:\s+-Xfrontend)?\s*([A-Za-z0-9]*)"
)
FEATURE_LIT_MARKER_RE = re.compile(r"swift_feature_([A-Za-z0-9]*)")