Skip to content

Commit f946134

Browse files
committed
Run ValidateSyntaxNodes tests in CI
Also update ValidateSyntaxNodes to match current state of syntax node names so that tests pass. rdar://110990221
1 parent 034dca0 commit f946134

File tree

2 files changed

+26
-33
lines changed

2 files changed

+26
-33
lines changed

CodeGeneration/Tests/ValidateSyntaxNodes/ValidateSyntaxNodes.swift

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ class ValidateSyntaxNodes: XCTestCase {
183183
node: .conventionWitnessMethodAttributeArguments,
184184
message: "child 'WitnessMethodLabel' has a single keyword as its only token choice and should thus be named 'Witness_methodKeyword'"
185185
),
186+
ValidationFailure(
187+
node: .deinitEffectSpecifiers,
188+
message: "child 'AsyncSpecifier' has a single keyword as its only token choice and should thus be named 'AsyncKeyword'"
189+
),
186190
ValidationFailure(
187191
node: .derivativeRegistrationAttributeArguments,
188192
message: "child 'OfLabel' has a single keyword as its only token choice and should thus be named 'OfKeyword'"
@@ -199,10 +203,6 @@ class ValidateSyntaxNodes: XCTestCase {
199203
node: .genericParameter,
200204
message: "child 'Each' has a single keyword as its only token choice and should thus be named 'EachKeyword'"
201205
),
202-
ValidationFailure(
203-
node: .importDecl,
204-
message: "child 'ImportTok' has a single keyword as its only token choice and should thus be named 'ImportKeyword'"
205-
),
206206
ValidationFailure(node: .isExpr, message: "child 'IsTok' has a single keyword as its only token choice and should thus be named 'IsKeyword'"),
207207
ValidationFailure(
208208
node: .originallyDefinedInArguments,
@@ -243,9 +243,6 @@ class ValidateSyntaxNodes: XCTestCase {
243243
ValidationFailure(node: .unresolvedAsExpr, message: "child 'AsTok' has a single keyword as its only token choice and should thus be named 'AsKeyword'"),
244244
ValidationFailure(node: .unresolvedIsExpr, message: "child 'IsTok' has a single keyword as its only token choice and should thus be named 'IsKeyword'"),
245245

246-
// MARK:
247-
ValidationFailure(node: .arrayExpr, message: "child 'LeftSquare' has a token as its only token choice and should thus be named 'LeftSquareBracket'"),
248-
ValidationFailure(node: .arrayExpr, message: "child 'RightSquare' has a token as its only token choice and should thus be named 'RightSquareBracket'"),
249246
ValidationFailure(node: .arrowExpr, message: "child 'ArrowToken' has a token as its only token choice and should thus be named 'Arrow'"),
250247
ValidationFailure(node: .assignmentExpr, message: "child 'AssignToken' has a token as its only token choice and should thus be named 'Equal'"),
251248
ValidationFailure(node: .attribute, message: "child 'AtSignToken' has a token as its only token choice and should thus be named 'AtSign'"),
@@ -256,26 +253,10 @@ class ValidateSyntaxNodes: XCTestCase {
256253
message: "child 'OperatorToken' has a token as its only token choice and should thus be named 'BinaryOperator'"
257254
),
258255
ValidationFailure(node: .closureCaptureItem, message: "child 'AssignToken' has a token as its only token choice and should thus be named 'Equal'"),
259-
ValidationFailure(
260-
node: .closureCaptureSignature,
261-
message: "child 'LeftSquare' has a token as its only token choice and should thus be named 'LeftSquareBracket'"
262-
),
263-
ValidationFailure(
264-
node: .closureCaptureSignature,
265-
message: "child 'RightSquare' has a token as its only token choice and should thus be named 'RightSquareBracket'"
266-
),
267256
ValidationFailure(
268257
node: .designatedTypeElement,
269258
message: "child 'LeadingComma' has a comma keyword as its only token choice and should thus be named 'Comma' or 'TrailingComma'"
270259
),
271-
ValidationFailure(
272-
node: .dictionaryExpr,
273-
message: "child 'LeftSquare' has a token as its only token choice and should thus be named 'LeftSquareBracket'"
274-
),
275-
ValidationFailure(
276-
node: .dictionaryExpr,
277-
message: "child 'RightSquare' has a token as its only token choice and should thus be named 'RightSquareBracket'"
278-
),
279260
ValidationFailure(
280261
node: .differentiableAttributeArguments,
281262
message: "child 'DiffKindComma' has a comma keyword as its only token choice and should thus be named 'Comma' or 'TrailingComma'"
@@ -313,11 +294,11 @@ class ValidateSyntaxNodes: XCTestCase {
313294
ValidationFailure(node: .integerLiteralExpr, message: "child 'Digits' has a token as its only token choice and should thus be named 'IntegerLiteral'"),
314295
ValidationFailure(
315296
node: .keyPathSubscriptComponent,
316-
message: "child 'LeftBracket' has a token as its only token choice and should thus be named 'LeftSquareBracket'"
297+
message: "child 'LeftBracket' has a token as its only token choice and should thus be named 'LeftSquare'"
317298
),
318299
ValidationFailure(
319300
node: .keyPathSubscriptComponent,
320-
message: "child 'RightBracket' has a token as its only token choice and should thus be named 'RightSquareBracket'"
301+
message: "child 'RightBracket' has a token as its only token choice and should thus be named 'RightSquare'"
321302
),
322303
ValidationFailure(node: .labeledStmt, message: "child 'LabelColon' has a token as its only token choice and should thus be named 'Colon'"),
323304
ValidationFailure(node: .layoutRequirement, message: "child 'Size' has a token as its only token choice and should thus be named 'IntegerLiteral'"),
@@ -395,11 +376,11 @@ class ValidateSyntaxNodes: XCTestCase {
395376
ValidationFailure(node: .stringSegment, message: "child 'Content' has a token as its only token choice and should thus be named 'StringSegment'"),
396377
ValidationFailure(
397378
node: .subscriptExpr,
398-
message: "child 'LeftBracket' has a token as its only token choice and should thus be named 'LeftSquareBracket'"
379+
message: "child 'LeftBracket' has a token as its only token choice and should thus be named 'LeftSquare'"
399380
),
400381
ValidationFailure(
401382
node: .subscriptExpr,
402-
message: "child 'RightBracket' has a token as its only token choice and should thus be named 'RightSquareBracket'"
383+
message: "child 'RightBracket' has a token as its only token choice and should thus be named 'RightSquare'"
403384
),
404385
ValidationFailure(
405386
node: .suppressedType,
@@ -501,10 +482,6 @@ class ValidateSyntaxNodes: XCTestCase {
501482
node: .precedenceGroupAssociativity,
502483
message: "child 'Value' only has keywords as its token choices and should thus and with 'Keyword'"
503484
),
504-
ValidationFailure(
505-
node: .precedenceGroupRelation,
506-
message: "child 'HigherThanOrLowerThan' only has keywords as its token choices and should thus and with 'Keyword'"
507-
),
508485
]
509486
)
510487
}

build-script.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,20 @@ def run_tests(
306306
)
307307

308308
run_xctests(
309+
package_dir=PACKAGE_DIR,
310+
test_product="swift-syntaxPackageTests",
311+
toolchain=toolchain,
312+
build_dir=build_dir,
313+
multiroot_data_file=multiroot_data_file,
314+
release=release,
315+
enable_rawsyntax_validation=enable_rawsyntax_validation,
316+
enable_test_fuzzing=enable_test_fuzzing,
317+
verbose=verbose,
318+
)
319+
320+
run_xctests(
321+
package_dir=CODE_GENERATION_DIR,
322+
test_product="CodeGenerationPackageTests",
309323
toolchain=toolchain,
310324
build_dir=build_dir,
311325
multiroot_data_file=multiroot_data_file,
@@ -398,6 +412,8 @@ def run_lit_tests(toolchain: str, build_dir: Optional[str], release: bool,
398412

399413

400414
def run_xctests(
415+
package_dir: str,
416+
test_product: str,
401417
toolchain: str,
402418
build_dir: Optional[str],
403419
multiroot_data_file: Optional[str],
@@ -410,7 +426,7 @@ def run_xctests(
410426
swiftpm_call = get_swiftpm_invocation(
411427
toolchain=toolchain,
412428
action="test",
413-
package_dir=PACKAGE_DIR,
429+
package_dir=package_dir,
414430
build_dir=build_dir,
415431
multiroot_data_file=multiroot_data_file,
416432
release=release,
@@ -419,7 +435,7 @@ def run_xctests(
419435
if verbose:
420436
swiftpm_call.extend(["--verbose"])
421437

422-
swiftpm_call.extend(["--test-product", "swift-syntaxPackageTests"])
438+
swiftpm_call.extend(["--test-product", test_product])
423439

424440
env = dict(os.environ)
425441
env["SWIFT_BUILD_SCRIPT_ENVIRONMENT"] = "1"

0 commit comments

Comments
 (0)