From cfa0294960ef654afbe46a9afabf350d1394aed9 Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Fri, 24 Mar 2023 09:42:30 -0700 Subject: [PATCH] Lowercase all `Assert` methods MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I think they were uppercase because they used to be called `XCTAssert*` but really it’s against all naming guidelines to start a Swift function with an uppercase letter. --- .../SwiftParser.docc/FixingBugs.md | 8 +- .../AssertEqualWithDiff.swift | 10 +- .../DiagnosticsFormatterTests.swift | 14 +- .../GroupDiagnosticsFormatterTests.swift | 4 +- Tests/SwiftParserTest/Assertions.swift | 52 +-- Tests/SwiftParserTest/AttributeTests.swift | 110 +++--- Tests/SwiftParserTest/AvailabilityTests.swift | 16 +- Tests/SwiftParserTest/DeclarationTests.swift | 282 +++++++-------- Tests/SwiftParserTest/DirectiveTests.swift | 20 +- Tests/SwiftParserTest/ExpressionTests.swift | 330 ++++++++--------- .../SwiftParserTest/ExpressionTypeTests.swift | 10 +- Tests/SwiftParserTest/LexerTests.swift | 210 +++++------ Tests/SwiftParserTest/Parser+EntryTests.swift | 10 +- Tests/SwiftParserTest/ParserTests.swift | 2 +- Tests/SwiftParserTest/StatementTests.swift | 98 ++--- .../TypeCompositionTests.swift | 2 +- Tests/SwiftParserTest/TypeMemberTests.swift | 12 +- Tests/SwiftParserTest/TypeMetatypeTests.swift | 2 +- Tests/SwiftParserTest/TypeTests.swift | 32 +- .../VariadicGenericsTests.swift | 112 +++--- .../translated/ActorTests.swift | 4 +- ...waysEmitConformanceMetadataAttrTests.swift | 2 +- .../translated/AsyncSyntaxTests.swift | 12 +- .../translated/AsyncTests.swift | 42 +-- .../translated/AvailabilityQueryTests.swift | 76 ++-- ...AvailabilityQueryUnavailabilityTests.swift | 74 ++-- .../translated/BorrowExprTests.swift | 4 +- .../translated/BraceRecoveryEofTests.swift | 2 +- .../translated/BuiltinBridgeObjectTests.swift | 8 +- .../translated/BuiltinWordTests.swift | 22 +- .../translated/ConflictMarkersTests.swift | 30 +- .../ConsecutiveStatementsTests.swift | 16 +- .../translated/DebuggerTests.swift | 8 +- .../translated/DelayedExtensionTests.swift | 2 +- .../translated/DeprecatedWhereTests.swift | 26 +- .../DiagnoseAvailabilityTests.swift | 42 +-- .../DiagnoseAvailabilityWindowsTests.swift | 14 +- .../DiagnoseDynamicReplacementTests.swift | 8 +- ...agnoseInitializerAsTypedPatternTests.swift | 38 +- .../DiagnosticMissingFuncKeywordTests.swift | 36 +- .../translated/DollarIdentifierTests.swift | 38 +- .../translated/EffectfulPropertiesTests.swift | 42 +-- .../EnumElementPatternSwift4Tests.swift | 10 +- .../translated/EnumTests.swift | 212 +++++------ .../translated/ErrorsTests.swift | 62 ++-- .../translated/EscapedIdentifiersTests.swift | 20 +- .../translated/ForeachAsyncTests.swift | 8 +- .../translated/ForeachTests.swift | 4 +- .../GenericDisambiguationTests.swift | 46 +-- .../translated/GuardTests.swift | 4 +- .../translated/GuardTopLevelTests.swift | 6 +- .../translated/HashbangLibraryTests.swift | 2 +- .../translated/HashbangMainTests.swift | 2 +- .../translated/IdentifiersTests.swift | 34 +- .../translated/IfconfigExprTests.swift | 76 ++-- .../ImplicitGetterIncompleteTests.swift | 4 +- .../translated/InitDeinitTests.swift | 64 ++-- .../translated/InvalidIfExprTests.swift | 8 +- ...alidStringInterpolationProtocolTests.swift | 14 +- .../translated/InvalidTests.swift | 98 ++--- .../translated/MatchingPatternsTests.swift | 70 ++-- .../MetatypeObjectConversionTests.swift | 10 +- .../translated/MoveExprTests.swift | 6 +- .../translated/MultilineErrorsTests.swift | 80 ++--- ...ePoundDiagnosticArgRdar41154797Tests.swift | 2 +- .../translated/MultilineStringTests.swift | 72 ++-- .../translated/NoimplicitcopyAttrTests.swift | 16 +- .../NumberIdentifierErrorsTests.swift | 38 +- .../translated/ObjcEnumTests.swift | 16 +- .../translated/ObjectLiteralsTests.swift | 28 +- .../OperatorDeclDesignatedTypesTests.swift | 38 +- .../translated/OperatorDeclTests.swift | 88 ++--- .../translated/OperatorsTests.swift | 70 ++-- .../OptionalChainLvaluesTests.swift | 16 +- .../translated/OptionalLvaluesTests.swift | 26 +- .../translated/OptionalTests.swift | 12 +- .../OriginalDefinedInAttrTests.swift | 30 +- .../PatternWithoutVariablesScriptTests.swift | 2 +- .../PatternWithoutVariablesTests.swift | 12 +- .../translated/PlaygroundLvaluesTests.swift | 4 +- .../translated/PoundAssertTests.swift | 12 +- .../translated/RawStringErrorsTests.swift | 16 +- .../translated/RawStringTests.swift | 62 ++-- .../translated/RecoveryLibraryTests.swift | 2 +- .../translated/RecoveryTests.swift | 334 +++++++++--------- .../translated/ResultBuilderTests.swift | 14 +- .../translated/SelfRebindingTests.swift | 20 +- .../translated/SemicolonTests.swift | 24 +- .../translated/StringLiteralEofTests.swift | 16 +- .../translated/SubscriptingTests.swift | 50 +-- .../translated/SuperTests.swift | 20 +- .../translated/SwitchIncompleteTests.swift | 2 +- .../translated/SwitchTests.swift | 168 ++++----- .../translated/ToplevelLibraryTests.swift | 6 +- .../translated/TrailingClosuresTests.swift | 34 +- .../translated/TrailingSemiTests.swift | 20 +- .../SwiftParserTest/translated/TryTests.swift | 110 +++--- .../translated/TypeExprTests.swift | 248 ++++++------- .../translated/TypealiasTests.swift | 30 +- .../UnclosedStringInterpolationTests.swift | 20 +- .../FormatRawStringLiteral.swift | 2 +- .../MigrateToNewIfLetSyntax.swift | 20 +- .../OpaqueParameterToGeneric.swift | 6 +- .../ReformatIntegerLiteral.swift | 4 +- .../ArrayExprTests.swift | 4 +- Tests/SwiftSyntaxBuilderTest/Assertions.swift | 4 +- .../BooleanLiteralTests.swift | 2 +- .../BreakStmtSyntaxTests.swift | 2 +- .../ClassDeclSyntaxTests.swift | 4 +- .../ClosureExprTests.swift | 2 +- .../CollectionNodeFlatteningTests.swift | 2 +- .../CustomAttributeTests.swift | 2 +- .../DictionaryExprTests.swift | 6 +- .../SwiftSyntaxBuilderTest/DoStmtTests.swift | 6 +- .../EnumCaseElementTests.swift | 2 +- .../ExprListTests.swift | 2 +- .../ExtensionDeclTests.swift | 2 +- .../FloatLiteralTests.swift | 2 +- .../FunctionTests.swift | 18 +- .../IfConfigDeclSyntaxTests.swift | 2 +- .../SwiftSyntaxBuilderTest/IfStmtTests.swift | 10 +- .../SwiftSyntaxBuilderTest/ImportTests.swift | 2 +- .../InitializerDeclTests.swift | 6 +- .../IntegerLiteralTests.swift | 2 +- .../ProtocolDeclTests.swift | 2 +- .../ReturnStmsTests.swift | 2 +- .../SourceFileTests.swift | 2 +- .../StringInterpolationTests.swift | 68 ++-- .../StringLiteralTests.swift | 50 +-- .../SwiftSyntaxBuilderTest/StructTests.swift | 6 +- .../SwitchCaseLabelSyntaxTests.swift | 2 +- .../SwiftSyntaxBuilderTest/SwitchTests.swift | 4 +- .../TernaryExprTests.swift | 2 +- .../SwiftSyntaxBuilderTest/TriviaTests.swift | 6 +- Tests/SwiftSyntaxBuilderTest/TupleTests.swift | 6 +- .../VariableTests.swift | 20 +- .../MacroReplacementTests.swift | 2 +- .../MacroSystemTests.swift | 28 +- 138 files changed, 2357 insertions(+), 2357 deletions(-) diff --git a/Sources/SwiftParser/SwiftParser.docc/FixingBugs.md b/Sources/SwiftParser/SwiftParser.docc/FixingBugs.md index 5f1a0a37432..89e22f200ee 100644 --- a/Sources/SwiftParser/SwiftParser.docc/FixingBugs.md +++ b/Sources/SwiftParser/SwiftParser.docc/FixingBugs.md @@ -10,7 +10,7 @@ Once you’ve written a test case (see below), set a breakpoint in `Parser.parse 1. Add a new test case in `SwiftParserTest` that looks like the following ```swift - AssertParse( + assertParse( """ <#your code that does not round trip#> """ @@ -27,7 +27,7 @@ Diagnostics are produced when the parsed syntax tree contains missing or unexpec 1. Add a test case in `SwiftParserTest` that looks like the following ```swift - AssertParse( + assertParse( """ <#your code that produces an invalid syntax tree#> """, @@ -54,7 +54,7 @@ To add a new, more contextual diagnostic, perform the following steps. 1. Add a test case in `SwiftParserTest` that looks like the following ```swift - AssertParse( + assertParse( """ <#your code that produced the unhelpful diagnostic#> """, @@ -69,7 +69,7 @@ To add a new, more contextual diagnostic, perform the following steps. 5. If the function does not already exist, write a new visit method on . 6. In that visitation method, detect the pattern for which the improved diagnostic should be emitted and emit it using `diagnostics.append`. 7. Mark the missing or garbage nodes that are covered by the new diagnostic as handled by adding their `SyntaxIdentifier`s to `handledNodes`. -8. If the diagnostic produces Fix-Its assert that they are generated by adding the Fix-It's message to the `DiagnosticSpec` with the `fixIt` parameter and asserting that applying the Fix-Its produces the correct source code by adding the `fixedSource` parameter to `AssertParse`. +8. If the diagnostic produces Fix-Its assert that they are generated by adding the Fix-It's message to the `DiagnosticSpec` with the `fixIt` parameter and asserting that applying the Fix-Its produces the correct source code by adding the `fixedSource` parameter to `assertParse`. > 💡 Tip: To make typing the marker emojis more convienient. you can set up code snippets in Xcode. To do this, perform the following steps: > 1. Type the marker in any Xcode window or find it in some test case diff --git a/Sources/_SwiftSyntaxTestSupport/AssertEqualWithDiff.swift b/Sources/_SwiftSyntaxTestSupport/AssertEqualWithDiff.swift index eaf3b00dda4..5cbdba1536c 100644 --- a/Sources/_SwiftSyntaxTestSupport/AssertEqualWithDiff.swift +++ b/Sources/_SwiftSyntaxTestSupport/AssertEqualWithDiff.swift @@ -23,7 +23,7 @@ import XCTest /// which this function was called. /// - line: The line number on which failure occurred. Defaults to the line number on which this /// function was called. -public func AssertStringsEqualWithDiff( +public func assertStringsEqualWithDiff( _ actual: String, _ expected: String, _ message: String = "", @@ -34,7 +34,7 @@ public func AssertStringsEqualWithDiff( if actual == expected { return } - FailStringsEqualWithDiff( + failStringsEqualWithDiff( actual, expected, message, @@ -55,7 +55,7 @@ public func AssertStringsEqualWithDiff( /// which this function was called. /// - line: The line number on which failure occurred. Defaults to the line number on which this /// function was called. -public func AssertDataEqualWithDiff( +public func assertDataEqualWithDiff( _ actual: Data, _ expected: Data, _ message: String = "", @@ -69,7 +69,7 @@ public func AssertDataEqualWithDiff( // NOTE: Converting to `Stirng` here looses invalid UTF8 sequence difference, // but at least we can see something is different. - FailStringsEqualWithDiff( + failStringsEqualWithDiff( String(decoding: actual, as: UTF8.self), String(decoding: expected, as: UTF8.self), message, @@ -80,7 +80,7 @@ public func AssertDataEqualWithDiff( } /// `XCTFail` with `diff`-style output. -public func FailStringsEqualWithDiff( +public func failStringsEqualWithDiff( _ actual: String, _ expected: String, _ message: String = "", diff --git a/Tests/SwiftDiagnosticsTest/DiagnosticsFormatterTests.swift b/Tests/SwiftDiagnosticsTest/DiagnosticsFormatterTests.swift index 0cda9a1be64..e601a22afd1 100644 --- a/Tests/SwiftDiagnosticsTest/DiagnosticsFormatterTests.swift +++ b/Tests/SwiftDiagnosticsTest/DiagnosticsFormatterTests.swift @@ -33,7 +33,7 @@ final class DiagnosticsFormatterTests: XCTestCase { │ ╰─ error: expected expression after operator """ - AssertStringsEqualWithDiff(annotate(source: source), expectedOutput) + assertStringsEqualWithDiff(annotate(source: source), expectedOutput) } func testMultipleDiagnosticsInOneLine() { @@ -47,7 +47,7 @@ final class DiagnosticsFormatterTests: XCTestCase { │ ╰─ error: expected name in member access """ - AssertStringsEqualWithDiff(annotate(source: source), expectedOutput) + assertStringsEqualWithDiff(annotate(source: source), expectedOutput) } func testLineSkipping() { @@ -78,7 +78,7 @@ final class DiagnosticsFormatterTests: XCTestCase { │ ╰─ error: expected value and ')' to end function call """ - AssertStringsEqualWithDiff(annotate(source: source), expectedOutput) + assertStringsEqualWithDiff(annotate(source: source), expectedOutput) } func testTwoDiagnosticsAtSameLocation() throws { @@ -91,7 +91,7 @@ final class DiagnosticsFormatterTests: XCTestCase { """ - AssertStringsEqualWithDiff(annotate(source: source), expectedOutput) + assertStringsEqualWithDiff(annotate(source: source), expectedOutput) } func testAddsColoringToSingleErrorDiagnostic() { @@ -104,7 +104,7 @@ final class DiagnosticsFormatterTests: XCTestCase { \u{001B}[0;36m│\u{001B}[0;0m ╰─ \u{001B}[1;31merror: expected expression after operator\u{001B}[0;0m """ - AssertStringsEqualWithDiff(annotate(source: source, colorize: true), expectedOutput) + assertStringsEqualWithDiff(annotate(source: source, colorize: true), expectedOutput) } func testAddsColoringToMultipleDiagnosticsInOneLine() { @@ -118,7 +118,7 @@ final class DiagnosticsFormatterTests: XCTestCase { \u{001B}[0;36m│\u{001B}[0;0m ╰─ \u{001B}[1;31merror: expected name in member access\u{001B}[0;0m """ - AssertStringsEqualWithDiff(annotate(source: source, colorize: true), expectedOutput) + assertStringsEqualWithDiff(annotate(source: source, colorize: true), expectedOutput) } func testColoringWithHighlights() { @@ -133,6 +133,6 @@ final class DiagnosticsFormatterTests: XCTestCase { """ - AssertStringsEqualWithDiff(annotate(source: source, colorize: true), expectedOutput) + assertStringsEqualWithDiff(annotate(source: source, colorize: true), expectedOutput) } } diff --git a/Tests/SwiftDiagnosticsTest/GroupDiagnosticsFormatterTests.swift b/Tests/SwiftDiagnosticsTest/GroupDiagnosticsFormatterTests.swift index 4bd68224b6a..d1c8d99704b 100644 --- a/Tests/SwiftDiagnosticsTest/GroupDiagnosticsFormatterTests.swift +++ b/Tests/SwiftDiagnosticsTest/GroupDiagnosticsFormatterTests.swift @@ -109,7 +109,7 @@ final class GroupedDiagnosticsFormatterTests: XCTestCase { ) let annotated = DiagnosticsFormatter.annotateSources(in: group) - AssertStringsEqualWithDiff( + assertStringsEqualWithDiff( annotated, """ === main.swift:5 === @@ -178,7 +178,7 @@ final class GroupedDiagnosticsFormatterTests: XCTestCase { ) let annotated = DiagnosticsFormatter.annotateSources(in: group) - AssertStringsEqualWithDiff( + assertStringsEqualWithDiff( annotated, """ === main.swift:2 === diff --git a/Tests/SwiftParserTest/Assertions.swift b/Tests/SwiftParserTest/Assertions.swift index 1e2fd7b34a7..f2020e15ffc 100644 --- a/Tests/SwiftParserTest/Assertions.swift +++ b/Tests/SwiftParserTest/Assertions.swift @@ -65,7 +65,7 @@ struct LexemeSpec { /// which this function was called. /// - line: The line number on which failure occurred. Defaults to the line number on which this /// function was called. -private func AssertTokens( +private func assertTokens( _ actual: [Lexer.Lexeme], _ expected: [LexemeSpec], markerLocations: [String: Int], @@ -98,7 +98,7 @@ private func AssertTokens( } if actualLexeme.leadingTriviaText != expectedLexeme.leadingTrivia { - FailStringsEqualWithDiff( + failStringsEqualWithDiff( String(syntaxText: actualLexeme.leadingTriviaText), String(syntaxText: expectedLexeme.leadingTrivia), "Leading trivia does not match", @@ -108,7 +108,7 @@ private func AssertTokens( } if actualLexeme.tokenText.debugDescription != expectedLexeme.tokenText.debugDescription { - FailStringsEqualWithDiff( + failStringsEqualWithDiff( actualLexeme.tokenText.debugDescription, expectedLexeme.tokenText.debugDescription, "Token text does not match", @@ -118,7 +118,7 @@ private func AssertTokens( } if actualLexeme.trailingTriviaText != expectedLexeme.trailingTrivia { - FailStringsEqualWithDiff( + failStringsEqualWithDiff( String(syntaxText: actualLexeme.trailingTriviaText), String(syntaxText: expectedLexeme.trailingTrivia), "Trailing trivia does not match", @@ -142,7 +142,7 @@ private func AssertTokens( line: expectedLexeme.line ) case (let actualError?, let expectedError?): - AssertStringsEqualWithDiff( + assertStringsEqualWithDiff( actualError.diagnosticMessage(wholeTextBytes: Array(actualLexeme.wholeText)).message, expectedError, file: expectedLexeme.file, @@ -175,7 +175,7 @@ private func AssertTokens( } } -func AssertLexemes( +func assertLexemes( _ markedSource: String, lexemes expectedLexemes: [LexemeSpec], file: StaticString = #file, @@ -196,7 +196,7 @@ func AssertLexemes( break } } - AssertTokens(lexemes, expectedLexemes, markerLocations: markerLocations, file: file, line: line) + assertTokens(lexemes, expectedLexemes, markerLocations: markerLocations, file: file, line: line) } } @@ -324,7 +324,7 @@ class FixItApplier: SyntaxRewriter { } /// Assert that `location` is the same as that of `locationMarker` in `tree`. -func AssertLocation( +func assertLocation( _ location: SourceLocation, in tree: T, markerLocations: [String: Int], @@ -354,7 +354,7 @@ func AssertLocation( /// Assert that the diagnostic `note` produced in `tree` matches `spec`, /// using `markerLocations` to translate markers to actual source locations. -func AssertNote( +func assertNote( _ note: Note, in tree: T, markerLocations: [String: Int], @@ -364,7 +364,7 @@ func AssertNote( ) { XCTAssertEqual(note.message, spec.message, file: file, line: line) let locationConverter = SourceLocationConverter(file: "", source: tree.description) - AssertLocation( + assertLocation( note.location(converter: locationConverter), in: tree, markerLocations: markerLocations, @@ -376,7 +376,7 @@ func AssertNote( /// Assert that the diagnostic `diag` produced in `tree` matches `spec`, /// using `markerLocations` to translate markers to actual source locations. -func AssertDiagnostic( +func assertDiagnostic( _ diag: Diagnostic, in tree: T, markerLocations: [String: Int], @@ -385,7 +385,7 @@ func AssertDiagnostic( line: UInt = #line ) { let locationConverter = SourceLocationConverter(file: "", source: tree.description) - AssertLocation( + assertLocation( diag.location(converter: locationConverter), in: tree, markerLocations: markerLocations, @@ -397,7 +397,7 @@ func AssertDiagnostic( XCTAssertEqual(diag.diagnosticID, id, file: file, line: line) } if let message = spec.message { - AssertStringsEqualWithDiff(diag.message, message, file: file, line: line) + assertStringsEqualWithDiff(diag.message, message, file: file, line: line) } XCTAssertEqual(spec.severity, diag.diagMessage.severity, file: file, line: line) if diag.message.contains("\n") { @@ -411,7 +411,7 @@ func AssertDiagnostic( ) } if let highlight = spec.highlight { - AssertStringsEqualWithDiff( + assertStringsEqualWithDiff( diag.highlights.map(\.description).joined().trimmingTrailingWhitespace(), highlight.trimmingTrailingWhitespace(), file: file, @@ -430,13 +430,13 @@ func AssertDiagnostic( ) } else { for (note, expectedNote) in zip(diag.notes, notes) { - AssertNote(note, in: tree, markerLocations: markerLocations, expected: expectedNote, file: expectedNote.file, line: expectedNote.line) + assertNote(note, in: tree, markerLocations: markerLocations, expected: expectedNote, file: expectedNote.file, line: expectedNote.line) } } } if let fixIts = spec.fixIts { if fixIts != diag.fixIts.map(\.message.message) { - FailStringsEqualWithDiff( + failStringsEqualWithDiff( diag.fixIts.map(\.message.message).joined(separator: "\n"), fixIts.joined(separator: "\n"), file: file, @@ -462,9 +462,9 @@ public struct AssertParseOptions: OptionSet { public static let normalizeNewlinesInFixedSource = AssertParseOptions(rawValue: 1 << 1) } -/// Same as `AssertParse` overload with a `(String) -> S` `parse`, +/// Same as `assertParse` overload with a `(String) -> S` `parse`, /// parsing the resulting `String` as a `SourceFileSyntax`. -func AssertParse( +func assertParse( _ markedSource: String, substructure expectedSubstructure: Syntax? = nil, substructureAfterMarker: String = "START", @@ -475,7 +475,7 @@ func AssertParse( file: StaticString = #file, line: UInt = #line ) { - AssertParse( + assertParse( markedSource, { SourceFileSyntax.parse(from: &$0) }, substructure: expectedSubstructure, @@ -489,10 +489,10 @@ func AssertParse( ) } -/// Same as `AssertParse` overload with a `(String) -> S` `parse`, +/// Same as `assertParse` overload with a `(String) -> S` `parse`, /// constructing a `Parser` from the given `String` and passing that to /// `parse` instead. -func AssertParse( +func assertParse( _ markedSource: String, _ parse: (inout Parser) -> S, substructure expectedSubstructure: Syntax? = nil, @@ -504,7 +504,7 @@ func AssertParse( file: StaticString = #file, line: UInt = #line ) { - AssertParse( + assertParse( markedSource, { (source: String) -> S in var parser = Parser(source) @@ -539,7 +539,7 @@ func AssertParse( /// - applyFixIts: Applies only the fix-its with these messages. /// - fixedSource: Asserts that the source after applying fix-its matches /// this string. -func AssertParse( +func assertParse( _ markedSource: String, _ parse: (String) -> S, substructure expectedSubstructure: Syntax? = nil, @@ -558,7 +558,7 @@ func AssertParse( let tree: S = parse(source) // Round-trip - AssertStringsEqualWithDiff( + assertStringsEqualWithDiff( "\(tree)", source, additionalInfo: """ @@ -594,7 +594,7 @@ func AssertParse( ) } else { for (diag, expectedDiag) in zip(diags, expectedDiagnostics) { - AssertDiagnostic(diag, in: tree, markerLocations: markerLocations, expected: expectedDiag, file: expectedDiag.file, line: expectedDiag.line) + assertDiagnostic(diag, in: tree, markerLocations: markerLocations, expected: expectedDiag, file: expectedDiag.file, line: expectedDiag.line) } } @@ -608,7 +608,7 @@ func AssertParse( .replacingOccurrences(of: "\r\n", with: "\n") .replacingOccurrences(of: "\r", with: "\n") } - AssertStringsEqualWithDiff( + assertStringsEqualWithDiff( fixedTreeDescription.trimmingTrailingWhitespace(), expectedFixedSource.trimmingTrailingWhitespace(), file: file, diff --git a/Tests/SwiftParserTest/AttributeTests.swift b/Tests/SwiftParserTest/AttributeTests.swift index dd108e0ff46..81bc05183c5 100644 --- a/Tests/SwiftParserTest/AttributeTests.swift +++ b/Tests/SwiftParserTest/AttributeTests.swift @@ -16,7 +16,7 @@ import XCTest final class AttributeTests: XCTestCase { func testMissingArgumentToAttribute() { - AssertParse( + assertParse( """ @_dynamicReplacement(1️⃣ func 2️⃣test_dynamic_replacement_for2() { @@ -35,7 +35,7 @@ final class AttributeTests: XCTestCase { } func testMissingGenericTypeToAttribute() { - AssertParse( + assertParse( """ @differentiable(reverse wrt1️⃣,where T2️⃣ func podcastPlaybackSpeed() { @@ -55,7 +55,7 @@ final class AttributeTests: XCTestCase { } func testMissingClosingParenToAttribute() { - AssertParse( + assertParse( """ @_specialize(e1️⃣ """, @@ -68,7 +68,7 @@ final class AttributeTests: XCTestCase { } func testMultipleInvalidSpecializeParams() { - AssertParse( + assertParse( """ @_specialize(e1️⃣, exported2️⃣)3️⃣ """, @@ -81,7 +81,7 @@ final class AttributeTests: XCTestCase { } func testObjCAttribute() { - AssertParse( + assertParse( """ @objc(zeroArg) class A { } @@ -91,7 +91,7 @@ final class AttributeTests: XCTestCase { """ ) - AssertParse( + assertParse( """ @objc(_:) func f(_: Int) @@ -100,7 +100,7 @@ final class AttributeTests: XCTestCase { } func testRethrowsAttribute() { - AssertParse( + assertParse( """ @1️⃣rethrows protocol P { } @@ -111,7 +111,7 @@ final class AttributeTests: XCTestCase { } func testAutoclosureAttribute() { - AssertParse( + assertParse( """ func f(in: @autoclosure () -> Int) { } func g(in: @autoclosure @escaping () -> Int) { } @@ -120,7 +120,7 @@ final class AttributeTests: XCTestCase { } func testDifferentiableAttribute() { - AssertParse( + assertParse( """ func f(in: @differentiable(reverse) (Int) -> Int) { } func f(in: @differentiable(reverse, wrt: a) (Int) -> Int) { } @@ -129,7 +129,7 @@ final class AttributeTests: XCTestCase { } func testQualifiedAttribute() { - AssertParse( + assertParse( """ @_Concurrency.MainActor(unsafe) public struct Image : SwiftUI.View {} """ @@ -137,7 +137,7 @@ final class AttributeTests: XCTestCase { } func testDerivativeAttribute() { - AssertParse( + assertParse( """ @inlinable @differentiable(reverse, wrt: self) @@ -149,7 +149,7 @@ final class AttributeTests: XCTestCase { """ ) - AssertParse( + assertParse( """ @inlinable @differentiable(reverse, wrt: (self, initialResult)) @@ -162,7 +162,7 @@ final class AttributeTests: XCTestCase { """ ) - AssertParse( + assertParse( """ @inlinable @derivative(of: differentiableReduce) @@ -179,7 +179,7 @@ final class AttributeTests: XCTestCase { } func testTransposeAttribute() { - AssertParse( + assertParse( """ @transpose(of: S.instanceMethod, wrt: self) static func transposeInstanceMethodWrtSelf(_ other: S, t: S) -> S { @@ -187,7 +187,7 @@ final class AttributeTests: XCTestCase { } """ ) - AssertParse( + assertParse( """ @transpose(of: +) func addTranspose(_ v: Float) -> (Float, Float) { @@ -196,7 +196,7 @@ final class AttributeTests: XCTestCase { """ ) - AssertParse( + assertParse( """ @transpose(of: -, wrt: (0, 1)) func subtractTranspose(_ v: Float) -> (Float, Float) { @@ -205,7 +205,7 @@ final class AttributeTests: XCTestCase { """ ) - AssertParse( + assertParse( """ @transpose(of: Float.-, wrt: (0, 1)) func subtractTranspose(_ v: Float) -> (Float, Float) { @@ -216,7 +216,7 @@ final class AttributeTests: XCTestCase { } func testImplementsAttribute() { - AssertParse( + assertParse( """ @_implements(P, f0()) func g0() -> Int { @@ -280,7 +280,7 @@ final class AttributeTests: XCTestCase { for (line, baseType) in cases { var parser = Parser(baseType) - AssertParse( + assertParse( "@_implements(1️⃣\(baseType), f())", AttributeSyntax.parse, substructure: Syntax(TypeSyntax.parse(from: &parser)), @@ -291,7 +291,7 @@ final class AttributeTests: XCTestCase { } func testSemanticsAttribute() { - AssertParse( + assertParse( """ @_semantics("constant_evaluable") func testRecursion(_ a: Int) -> Int { @@ -307,7 +307,7 @@ final class AttributeTests: XCTestCase { } func testMissingDeclarationAfterAttributes() { - AssertParse( + assertParse( "@resultBuilder1️⃣", diagnostics: [DiagnosticSpec(message: "expected declaration after attribute")], fixedSource: """ @@ -318,7 +318,7 @@ final class AttributeTests: XCTestCase { } func testObjcImplementationAttribute() { - AssertParse( + assertParse( """ @_objcImplementation extension MyClass { func fn() {} @@ -331,7 +331,7 @@ final class AttributeTests: XCTestCase { } func testSpiAttributeWithoutParameter() { - AssertParse( + assertParse( "@_spi(1️⃣) class Foo {}", diagnostics: [ DiagnosticSpec(message: "expected argument for '@_spi' attribute", fixIts: ["insert attribute argument"]) @@ -341,14 +341,14 @@ final class AttributeTests: XCTestCase { } func testSilgenName() { - AssertParse( + assertParse( """ @_silgen_name("testExclusivityBogusPC") private static func _testExclusivityBogusPC() """ ) - AssertParse( + assertParse( """ @_silgen_name("") func foo() {} """ @@ -356,21 +356,21 @@ final class AttributeTests: XCTestCase { } func testBackDeployed() { - AssertParse( + assertParse( """ @backDeployed(before: macOS 12.0) struct Foo {} """ ) - AssertParse( + assertParse( """ @backDeployed(before: macos 12.0, iOS 15.0) struct Foo {} """ ) - AssertParse( + assertParse( """ @available(macOS 11.0, *) @backDeployed(before: _macOS12_1) @@ -379,21 +379,21 @@ final class AttributeTests: XCTestCase { ) // Legacy spelling @_backDeploy(before:) - AssertParse( + assertParse( """ @_backDeploy(before: macOS 12.0) struct Foo {} """ ) - AssertParse( + assertParse( """ @_backDeploy(before: macos 12.0, iOS 15.0) struct Foo {} """ ) - AssertParse( + assertParse( """ @available(macOS 11.0, *) @_backDeploy(before: _macOS12_1) @@ -403,25 +403,25 @@ final class AttributeTests: XCTestCase { } func testExpose() { - AssertParse( + assertParse( """ @_expose(Cxx) func foo() {} """ ) - AssertParse( + assertParse( """ @_expose(Cplusplus) func foo() {} """ ) - AssertParse( + assertParse( """ @_expose(Cxx, "baz") func foo() {} """ ) - AssertParse( + assertParse( """ @_expose(Cxx, 1️⃣baz) func foo() {} """, @@ -433,21 +433,21 @@ final class AttributeTests: XCTestCase { } func testOriginallyDefinedIn() { - AssertParse( + assertParse( """ @_originallyDefinedIn(module: "ToasterKit", macOS 10.15) struct Vehicle {} """ ) - AssertParse( + assertParse( """ @_originallyDefinedIn(module: "ToasterKit", macOS 10.15, iOS 13) struct Vehicle {} """ ) - AssertParse( + assertParse( """ @_originallyDefinedIn(module: "ToasterKit", _iOS13Aligned) struct Vehicle {} @@ -456,21 +456,21 @@ final class AttributeTests: XCTestCase { } func testUnavailableFromAsync() { - AssertParse( + assertParse( """ @_unavailableFromAsync func foo() {} """ ) - AssertParse( + assertParse( """ @_unavailableFromAsync(message: "abc") func foo() {} """ ) - AssertParse( + assertParse( """ @_unavailableFromAsync(1️⃣nope: "abc") func foo() {} @@ -481,7 +481,7 @@ final class AttributeTests: XCTestCase { ] ) - AssertParse( + assertParse( """ @_unavailableFromAsync(message1️⃣= "abc") func foo() {} @@ -492,7 +492,7 @@ final class AttributeTests: XCTestCase { ] ) - AssertParse( + assertParse( """ @_unavailableFromAsync(message: 1️⃣abc) func foo() {} @@ -505,14 +505,14 @@ final class AttributeTests: XCTestCase { } func testEffects() { - AssertParse( + assertParse( """ @_effects(notEscaping self.value**) func foo() {} """ ) - AssertParse( + assertParse( """ @_effects(escaping self.value**.class*.value** => return.value**) func foo() {} @@ -521,13 +521,13 @@ final class AttributeTests: XCTestCase { } func testEscapingOnClosureType() { - AssertParse( + assertParse( "func foo(closure: @escaping () -> Void) {}" ) } func testNonSendable() { - AssertParse( + assertParse( """ @_nonSendable class NonSendableType { @@ -537,19 +537,19 @@ final class AttributeTests: XCTestCase { } func testDocumentationAttribute() { - AssertParse("@_documentation(visibility: internal) @_exported import A") - AssertParse("@_documentation(metadata: cool_stuff) public class SomeClass {}") - AssertParse(#"@_documentation(metadata: "this is a longer string") public class OtherClass {}"#) - AssertParse(#"@_documentation(visibility: internal, metadata: "this is a longer string") public class OtherClass {}"#) + assertParse("@_documentation(visibility: internal) @_exported import A") + assertParse("@_documentation(metadata: cool_stuff) public class SomeClass {}") + assertParse(#"@_documentation(metadata: "this is a longer string") public class OtherClass {}"#) + assertParse(#"@_documentation(visibility: internal, metadata: "this is a longer string") public class OtherClass {}"#) } func testSendable() { - AssertParse("func takeRepeater(_ f: @MainActor @Sendable @escaping () -> Int) {}") - AssertParse("takeRepesater { @MainActor @Sendable () -> Int in 0 }") + assertParse("func takeRepeater(_ f: @MainActor @Sendable @escaping () -> Int) {}") + assertParse("takeRepesater { @MainActor @Sendable () -> Int in 0 }") } func testLexicalLifetimes() { - AssertParse( + assertParse( """ @_lexicalLifetimes func lexy(_ c: C) {} @@ -558,7 +558,7 @@ final class AttributeTests: XCTestCase { } func testImportAttributes() { - AssertParse( + assertParse( """ import A @_implementationOnly import B diff --git a/Tests/SwiftParserTest/AvailabilityTests.swift b/Tests/SwiftParserTest/AvailabilityTests.swift index 1080037b7a1..80a57273266 100644 --- a/Tests/SwiftParserTest/AvailabilityTests.swift +++ b/Tests/SwiftParserTest/AvailabilityTests.swift @@ -16,7 +16,7 @@ import XCTest final class AvailabilityTests: XCTestCase { func testAvailableMember() { - AssertParse( + assertParse( """ @available(OSX 10.0, introduced: 10.12) // expected-error@-1 {{'introduced' can't be combined with shorthand specification 'OSX 10.0'}} @@ -25,14 +25,14 @@ final class AvailabilityTests: XCTestCase { """ ) - AssertParse( + assertParse( """ @available(iOS 6.0, OSX 10.8, *) func availableOnMultiplePlatforms() {} """ ) - AssertParse( + assertParse( """ class IncrementalParseTransition { @available(*, deprecated, message: "Use the initializer taking 'ConcurrentEdits' instead") @@ -41,7 +41,7 @@ final class AvailabilityTests: XCTestCase { """ ) - AssertParse( + assertParse( """ extension String { @available(macOS 10.15.4, iOS 13.4, watchOS 6.2, tvOS 13.4, *) @@ -53,7 +53,7 @@ final class AvailabilityTests: XCTestCase { """ ) - AssertParse( + assertParse( """ @available( iOSApplicationExtension, @@ -67,14 +67,14 @@ final class AvailabilityTests: XCTestCase { } func testAvailabilityMacros() { - AssertParse( + assertParse( """ @available(_iOS9, _macOS10_11, tvOS 11.0, *) public func composed() {} """ ) - AssertParse( + assertParse( """ @_specialize(exported: true, availability: SwiftStdlib 5.1, *; where T == Int) public func testSemanticsAvailability(_ t: T) {} @@ -83,7 +83,7 @@ final class AvailabilityTests: XCTestCase { } func testSPIAvailabilityAttribute() { - AssertParse( + assertParse( """ @_spi_available(*, deprecated, renamed: "another") public class SPIClass1 {} diff --git a/Tests/SwiftParserTest/DeclarationTests.swift b/Tests/SwiftParserTest/DeclarationTests.swift index 3d784d73ea8..26a7c23acdb 100644 --- a/Tests/SwiftParserTest/DeclarationTests.swift +++ b/Tests/SwiftParserTest/DeclarationTests.swift @@ -18,24 +18,24 @@ import XCTest final class DeclarationTests: XCTestCase { func testImports() { - AssertParse("import Foundation") + assertParse("import Foundation") - AssertParse("@_spi(Private) import SwiftUI") + assertParse("@_spi(Private) import SwiftUI") - AssertParse("@_exported import class Foundation.Thread") + assertParse("@_exported import class Foundation.Thread") - AssertParse(#"@_private(sourceFile: "YetAnotherFile.swift") import Foundation"#) + assertParse(#"@_private(sourceFile: "YetAnotherFile.swift") import Foundation"#) } func testStructParsing() { - AssertParse("struct Foo {}") + assertParse("struct Foo {}") } func testFuncParsing() { - AssertParse("func foo() {}") + assertParse("func foo() {}") - AssertParse("func foo() -> Slice> {}") + assertParse("func foo() -> Slice> {}") - AssertParse( + assertParse( """ func onEscapingAutoclosure(_ fn: @Sendable @autoclosure @escaping () -> Int) { } func onEscapingAutoclosure2(_ fn: @escaping @autoclosure @Sendable () -> Int) { } @@ -47,7 +47,7 @@ final class DeclarationTests: XCTestCase { """ ) - AssertParse( + assertParse( """ func 1️⃣where2️⃣ r3️⃣ @@ -63,9 +63,9 @@ final class DeclarationTests: XCTestCase { """ ) - AssertParse("func /^/ (lhs: Int, rhs: Int) -> Int { 1 / 2 }") + assertParse("func /^/ (lhs: Int, rhs: Int) -> Int { 1 / 2 }") - AssertParse( + assertParse( "func 1️⃣/^notoperator^/ (lhs: Int, rhs: Int) -> Int { 1 / 2 }", diagnostics: [ DiagnosticSpec(message: "expected identifier in function"), @@ -73,9 +73,9 @@ final class DeclarationTests: XCTestCase { ] ) - AssertParse("func /^ (lhs: Int, rhs: Int) -> Int { 1 / 2 }") + assertParse("func /^ (lhs: Int, rhs: Int) -> Int { 1 / 2 }") - AssertParse( + assertParse( """ func name(_ default: Int) {} """, @@ -91,7 +91,7 @@ final class DeclarationTests: XCTestCase { } func testFuncAfterUnbalancedClosingBrace() { - AssertParse( + assertParse( """ 1️⃣} func foo() {} @@ -103,9 +103,9 @@ final class DeclarationTests: XCTestCase { } func testClassParsing() { - AssertParse("class Foo {}") + assertParse("class Foo {}") - AssertParse( + assertParse( """ @dynamicMemberLookup @available(swift 4.0) public class MyClass { @@ -115,19 +115,19 @@ final class DeclarationTests: XCTestCase { """ ) - AssertParse( + assertParse( "<@NSApplicationMain T: AnyObject>", { GenericParameterClauseSyntax.parse(from: &$0) } ) - AssertParse( + assertParse( "class T where t1️⃣", diagnostics: [ DiagnosticSpec(message: "expected ':' or '==' to indicate a conformance or same-type requirement"), DiagnosticSpec(message: "expected member block in class"), ] ) - AssertParse( + assertParse( "class B?(from: decoder)") + assertParse("var a = Array?(from: decoder)") - AssertParse("@Wrapper var café = 42") + assertParse("@Wrapper var café = 42") - AssertParse( + assertParse( """ var x: T { get async { @@ -239,7 +239,7 @@ final class DeclarationTests: XCTestCase { """ ) - AssertParse( + assertParse( """ var foo: Int { _read { @@ -253,7 +253,7 @@ final class DeclarationTests: XCTestCase { """ ) - AssertParse( + assertParse( """ var foo: Int { @available(swift 5.0) @@ -265,7 +265,7 @@ final class DeclarationTests: XCTestCase { """ ) - AssertParse( + assertParse( """ var foo: Int { mutating set { @@ -277,7 +277,7 @@ final class DeclarationTests: XCTestCase { } func testAccessLevelModifier() { - AssertParse( + assertParse( """ open1️⃣ open(set)2️⃣ var openProp = 0 public public(set) var publicProp = 0 @@ -293,7 +293,7 @@ final class DeclarationTests: XCTestCase { ] ) - AssertParse( + assertParse( """ private(1️⃣get) var a = 0 """, @@ -303,7 +303,7 @@ final class DeclarationTests: XCTestCase { ] ) - AssertParse( + assertParse( """ private(1️⃣+ set @@ -316,7 +316,7 @@ final class DeclarationTests: XCTestCase { ] ) - AssertParse( + assertParse( """ private(1️⃣get, set) var a = 0 """, @@ -325,7 +325,7 @@ final class DeclarationTests: XCTestCase { ] ) - AssertParse( + assertParse( """ private(1️⃣get: set) var a = 0 """, @@ -334,7 +334,7 @@ final class DeclarationTests: XCTestCase { ] ) - AssertParse( + assertParse( """ 1️⃣private( """, @@ -343,7 +343,7 @@ final class DeclarationTests: XCTestCase { ] ) - AssertParse( + assertParse( """ private(1️⃣var a = 0 """, @@ -352,7 +352,7 @@ final class DeclarationTests: XCTestCase { ] ) - AssertParse( + assertParse( """ private(1️⃣get, set2️⃣, didSet) var a = 0 """, @@ -362,7 +362,7 @@ final class DeclarationTests: XCTestCase { ] ) - AssertParse( + assertParse( """ private(1️⃣get, didSet var a = 0 """, @@ -374,15 +374,15 @@ final class DeclarationTests: XCTestCase { } func testTypealias() { - AssertParse("typealias Foo = Int") + assertParse("typealias Foo = Int") - AssertParse("typealias MyAlias = (_ a: Int, _ b: Double, _ c: Bool, _ d: String) -> Bool") + assertParse("typealias MyAlias = (_ a: Int, _ b: Double, _ c: Bool, _ d: String) -> Bool") - AssertParse("typealias A = @attr1 @attr2(hello) (Int) -> Void") + assertParse("typealias A = @attr1 @attr2(hello) (Int) -> Void") } func testPrecedenceGroup() { - AssertParse( + assertParse( """ precedencegroup FooGroup { higherThan: Group1, Group2 @@ -393,7 +393,7 @@ final class DeclarationTests: XCTestCase { """ ) - AssertParse( + assertParse( """ precedencegroup FunnyPrecedence { associativity: left @@ -404,9 +404,9 @@ final class DeclarationTests: XCTestCase { } func testOperators() { - AssertParse("infix operator *-* : FunnyPrecedence") + assertParse("infix operator *-* : FunnyPrecedence") - AssertParse( + assertParse( """ infix operator <*<<< : MediumPrecedence, & prefix operator ^^ : PrefixMagicOperatorProtocol @@ -418,7 +418,7 @@ final class DeclarationTests: XCTestCase { } func testObjCAttribute() { - AssertParse( + assertParse( """ @objc( thisMethodHasAVeryLongName: @@ -431,7 +431,7 @@ final class DeclarationTests: XCTestCase { } func testDifferentiableAttribute() { - AssertParse( + assertParse( """ @differentiable(wrt: x where T: D) func foo(_ x: T) -> T {} @@ -449,15 +449,15 @@ final class DeclarationTests: XCTestCase { } func testParsePoundError() { - AssertParse(#"#error("Unsupported platform")"#) + assertParse(#"#error("Unsupported platform")"#) } func testParsePoundWarning() { - AssertParse(#"#warning("Unsupported platform")"#) + assertParse(#"#warning("Unsupported platform")"#) } func testParseSpecializeAttribute() { - AssertParse( + assertParse( #""" @_specialize(where T == Int, U == Float) mutating func exchangeSecond(_ u: U, _ t: T) -> (U, T) { @@ -516,7 +516,7 @@ final class DeclarationTests: XCTestCase { """# ) - AssertParse( + assertParse( """ @_specialize(where T: _Trivial(32), T: _Trivial(64), T: _Trivial, T: _RefCountedObject) @_specialize(where T: _Trivial, T: _Trivial(64)) @@ -531,7 +531,7 @@ final class DeclarationTests: XCTestCase { } func testParseDynamicReplacement() { - AssertParse( + assertParse( """ @_dynamicReplacement(for: dynamic_replaceable()) func replacement() { @@ -540,7 +540,7 @@ final class DeclarationTests: XCTestCase { """ ) - AssertParse( + assertParse( """ @_dynamicReplacement(for: subscript(_:)) subscript(x y: Int) -> Int { @@ -554,7 +554,7 @@ final class DeclarationTests: XCTestCase { """ ) - AssertParse( + assertParse( """ @_dynamicReplacement(for: dynamic_replaceable_var) var r : Int { @@ -563,7 +563,7 @@ final class DeclarationTests: XCTestCase { """ ) - AssertParse( + assertParse( """ @_dynamicReplacement(for: init(x:)) init(y: Int) { @@ -574,7 +574,7 @@ final class DeclarationTests: XCTestCase { } func testEnumParsing() { - AssertParse( + assertParse( """ enum Foo { @preconcurrency case custom(@Sendable () throws -> Void) @@ -582,7 +582,7 @@ final class DeclarationTests: XCTestCase { """ ) - AssertParse( + assertParse( """ enum Content { case keyPath(KeyPath) @@ -594,7 +594,7 @@ final class DeclarationTests: XCTestCase { } func testStandaloneModifier() { - AssertParse( + assertParse( """ struct a { public1️⃣ @@ -607,7 +607,7 @@ final class DeclarationTests: XCTestCase { } func testMissingColonInFunctionSignature() { - AssertParse( + assertParse( "func test(first second 1️⃣Int)", diagnostics: [ DiagnosticSpec(message: "expected ':' in parameter") @@ -616,7 +616,7 @@ final class DeclarationTests: XCTestCase { } func testExtraArgumentLabelsInFunctionSignature() { - AssertParse( + assertParse( "func test(first second 1️⃣third fourth: Int)", diagnostics: [ DiagnosticSpec(message: "unexpected code 'third fourth' in parameter") @@ -625,7 +625,7 @@ final class DeclarationTests: XCTestCase { } func testMissingClosingParenInFunctionSignature() { - AssertParse( + assertParse( "func test(first second: Int1️⃣", diagnostics: [ DiagnosticSpec(message: "expected ')' to end parameter clause") @@ -634,7 +634,7 @@ final class DeclarationTests: XCTestCase { } func testMissingOpeningParenInFunctionSignature() { - AssertParse( + assertParse( "func test 1️⃣first second: Int)", diagnostics: [ DiagnosticSpec(message: "expected '(' to start parameter clause") @@ -643,7 +643,7 @@ final class DeclarationTests: XCTestCase { } func testNoParamsForFunction() { - AssertParse( + assertParse( """ class MyClass { func withoutParameters1️⃣ @@ -671,7 +671,7 @@ final class DeclarationTests: XCTestCase { } func testThrowsInWrongLocation() { - AssertParse( + assertParse( "func test() -> 1️⃣throws Int", diagnostics: [ DiagnosticSpec(message: "'throws' must preceed '->'", fixIts: ["move 'throws' in front of '->'"]) @@ -681,7 +681,7 @@ final class DeclarationTests: XCTestCase { } func testExtraneousRightBraceRecovery() { - AssertParse( + assertParse( """ class ABC { let def = ghi(jkl: mno) @@ -695,7 +695,7 @@ final class DeclarationTests: XCTestCase { } func testMissingSubscriptReturnClause() { - AssertParse( + assertParse( """ struct Foo { subscript(x: String) 1️⃣{} @@ -708,7 +708,7 @@ final class DeclarationTests: XCTestCase { } func testClassWithLeadingNumber() { - AssertParse( + assertParse( """ class 1️⃣23class { func 2️⃣24method() {} @@ -722,7 +722,7 @@ final class DeclarationTests: XCTestCase { } func testAccessors() { - AssertParse( + assertParse( """ var bad1 : Int { _read async { 0 } @@ -730,7 +730,7 @@ final class DeclarationTests: XCTestCase { """ ) - AssertParse( + assertParse( """ var bad2 : Int { get reasync { 0 } @@ -740,7 +740,7 @@ final class DeclarationTests: XCTestCase { } func testExpressionMember() { - AssertParse( + assertParse( """ struct S { 1️⃣/ 2️⃣#3️⃣#4️⃣#line 5️⃣25 "line-directive.swift" @@ -757,7 +757,7 @@ final class DeclarationTests: XCTestCase { } func testBogusProtocolRequirements() { - AssertParse( + assertParse( """ protocol P { var prop : Int { get 1️⃣bogus rethrows set } @@ -784,7 +784,7 @@ final class DeclarationTests: XCTestCase { } func testTextRecovery() { - AssertParse( + assertParse( """ Lorem1️⃣ ipsum2️⃣ dolor3️⃣ sit4️⃣ amet5️⃣, consectetur adipiscing elit """, @@ -799,7 +799,7 @@ final class DeclarationTests: XCTestCase { } func testRecoverOneExtraLabel() { - AssertParse( + assertParse( "func test(first second 1️⃣third: Int)", substructure: Syntax( FunctionParameterSyntax( @@ -817,7 +817,7 @@ final class DeclarationTests: XCTestCase { } func testRecoverTwoExtraLabels() { - AssertParse( + assertParse( "func test(first second 1️⃣third fourth: Int)", substructure: Syntax( FunctionParameterSyntax( @@ -835,7 +835,7 @@ final class DeclarationTests: XCTestCase { } func testDontRecoverFromDeclKeyword() { - AssertParse( + assertParse( "func foo(first second 1️⃣third 2️⃣struct3️⃣: Int4️⃣) {}", substructure: Syntax( FunctionParameterSyntax( @@ -855,7 +855,7 @@ final class DeclarationTests: XCTestCase { } func testRecoverFromParens() { - AssertParse( + assertParse( "func test(first second 1️⃣[third fourth]: Int)", substructure: Syntax( FunctionParameterSyntax( @@ -878,7 +878,7 @@ final class DeclarationTests: XCTestCase { } func testDontRecoverFromUnbalancedParens() { - AssertParse( + assertParse( "func foo(first second 1️⃣[third 2️⃣fourth: Int) {}", substructure: Syntax( FunctionParameterSyntax( @@ -901,7 +901,7 @@ final class DeclarationTests: XCTestCase { } func testDontRecoverIfNewlineIsBeforeColon() { - AssertParse( + assertParse( """ func foo(first second 1️⃣third2️⃣ 3️⃣: Int) {} @@ -923,7 +923,7 @@ final class DeclarationTests: XCTestCase { } func testMalforedStruct() { - AssertParse( + assertParse( """ struct n1️⃣ #if2️⃣ @@ -941,7 +941,7 @@ final class DeclarationTests: XCTestCase { } func testInitializers() { - AssertParse( + assertParse( """ struct S0 { init!(int: Int) { } @@ -957,12 +957,12 @@ final class DeclarationTests: XCTestCase { } func testDeinitializers() { - AssertParse("deinit {}") - AssertParse("deinit") + assertParse("deinit {}") + assertParse("deinit") } func testAttributedMember() { - AssertParse( + assertParse( #""" struct Foo { @Argument(help: "xxx") @@ -973,17 +973,17 @@ final class DeclarationTests: XCTestCase { } func testAnyAsParameterLabel() { - AssertParse( + assertParse( "func at(any kinds: [RawTokenKind]) {}" ) } func testPublicClass() { - AssertParse("public class Foo: Superclass {}") + assertParse("public class Foo: Superclass {}") } func testReturnVariableNamedAsync() { - AssertParse( + assertParse( ##""" if let async = self.consume(if: .keyword(.async)) { return async @@ -997,7 +997,7 @@ final class DeclarationTests: XCTestCase { } func testLeadingUnexpectedTokens() { - AssertParse( + assertParse( "1️⃣}class C2️⃣", diagnostics: [ DiagnosticSpec(locationMarker: "1️⃣", message: "unexpected brace before class"), @@ -1007,49 +1007,49 @@ final class DeclarationTests: XCTestCase { }class C {} """ ) - AssertParse( + assertParse( "1️⃣}enum C2️⃣", diagnostics: [ DiagnosticSpec(locationMarker: "1️⃣", message: "unexpected brace before enum"), DiagnosticSpec(locationMarker: "2️⃣", message: "expected member block in enum"), ] ) - AssertParse( + assertParse( "1️⃣}protocol C2️⃣", diagnostics: [ DiagnosticSpec(locationMarker: "1️⃣", message: "unexpected brace before protocol"), DiagnosticSpec(locationMarker: "2️⃣", message: "expected member block in protocol"), ] ) - AssertParse( + assertParse( "1️⃣}actor C2️⃣", diagnostics: [ DiagnosticSpec(locationMarker: "1️⃣", message: "unexpected brace before actor"), DiagnosticSpec(locationMarker: "2️⃣", message: "expected member block in actor"), ] ) - AssertParse( + assertParse( "1️⃣}struct C2️⃣", diagnostics: [ DiagnosticSpec(locationMarker: "1️⃣", message: "unexpected brace before struct"), DiagnosticSpec(locationMarker: "2️⃣", message: "expected member block in struct"), ] ) - AssertParse( + assertParse( "1️⃣}func C2️⃣", diagnostics: [ DiagnosticSpec(locationMarker: "1️⃣", message: "unexpected brace before function"), DiagnosticSpec(locationMarker: "2️⃣", message: "expected parameter clause in function signature"), ] ) - AssertParse( + assertParse( "1️⃣}init2️⃣", diagnostics: [ DiagnosticSpec(locationMarker: "1️⃣", message: "unexpected brace before initializer"), DiagnosticSpec(locationMarker: "2️⃣", message: "expected parameter clause in function signature"), ] ) - AssertParse( + assertParse( "1️⃣}subscript2️⃣", diagnostics: [ DiagnosticSpec(locationMarker: "1️⃣", message: "unexpected brace before subscript"), @@ -1060,7 +1060,7 @@ final class DeclarationTests: XCTestCase { } func testBogusTypeDeclName() { - AssertParse( + assertParse( "associatedtype 1️⃣5s", diagnostics: [ DiagnosticSpec(message: "identifier can only start with a letter or underscore, not a number") @@ -1069,49 +1069,49 @@ final class DeclarationTests: XCTestCase { } func testModifiedParameter() { - AssertParse( + assertParse( """ func const(_const _ map: String) {} """ ) - AssertParse( + assertParse( """ func isolated(isolated _ 1️⃣map: String) {} """ ) - AssertParse( + assertParse( """ func isolatedConst(isolated _const _ 1️⃣map: String) {} """ ) - AssertParse( + assertParse( """ func nonEphemeralIsolatedConst(@_nonEmphemeral isolated _const _ 1️⃣map: String) {} """ ) - AssertParse( + assertParse( """ func const(_const map: String) {} """ ) - AssertParse( + assertParse( """ func isolated(isolated map: String) {} """ ) - AssertParse( + assertParse( """ func isolatedConst(isolated _const map1️⃣: String) {} """ ) - AssertParse( + assertParse( """ func const(_const x: String) {} func isolated(isolated: String) {} @@ -1121,7 +1121,7 @@ final class DeclarationTests: XCTestCase { } func testReasyncFunctions() { - AssertParse( + assertParse( """ class MyType { init(_ f: () async -> Void) reasync { @@ -1137,7 +1137,7 @@ final class DeclarationTests: XCTestCase { } func testStandaloneAtSignInGenericParameter() { - AssertParse( + assertParse( """ struct U<@1️⃣ """, @@ -1151,7 +1151,7 @@ final class DeclarationTests: XCTestCase { } func testMatchBracesBasedOnSpaces() { - AssertParse( + assertParse( """ struct Foo { struct Bar 1️⃣ @@ -1164,7 +1164,7 @@ final class DeclarationTests: XCTestCase { } func testFunctionWithoutNameOrArguments() { - AssertParse( + assertParse( "func 1️⃣{}", diagnostics: [ DiagnosticSpec(message: "expected identifier and function signature in function") @@ -1173,14 +1173,14 @@ final class DeclarationTests: XCTestCase { } func testMacroExpansionDeclaration() { - AssertParse( + assertParse( """ struct X { #memberwiseInit(access: .public) } """ ) - AssertParse( + assertParse( """ #expand """, @@ -1195,7 +1195,7 @@ final class DeclarationTests: XCTestCase { } func testVariableDeclWithGetSetButNoBrace() { - AssertParse( + assertParse( """ struct Foo { var x: Int 1️⃣ @@ -1215,7 +1215,7 @@ final class DeclarationTests: XCTestCase { } func testVariableDeclWithSetGetButNoBrace() { - AssertParse( + assertParse( """ struct Foo { var x: Int 1️⃣ @@ -1235,7 +1235,7 @@ final class DeclarationTests: XCTestCase { } func testVariableFollowedByReferenceToSet() { - AssertParse( + assertParse( """ func bar() { let a = b @@ -1246,10 +1246,10 @@ final class DeclarationTests: XCTestCase { } func testNominalDeclarationRecovery() { - AssertParse("protocol 1️⃣{}", diagnostics: [DiagnosticSpec(message: "expected identifier in protocol")]) - AssertParse("class 1️⃣{}", diagnostics: [DiagnosticSpec(message: "expected identifier in class")]) - AssertParse("struct 1️⃣{}", diagnostics: [DiagnosticSpec(message: "expected identifier in struct")]) - AssertParse("enum 1️⃣{}", diagnostics: [DiagnosticSpec(message: "expected identifier in enum")]) + assertParse("protocol 1️⃣{}", diagnostics: [DiagnosticSpec(message: "expected identifier in protocol")]) + assertParse("class 1️⃣{}", diagnostics: [DiagnosticSpec(message: "expected identifier in class")]) + assertParse("struct 1️⃣{}", diagnostics: [DiagnosticSpec(message: "expected identifier in struct")]) + assertParse("enum 1️⃣{}", diagnostics: [DiagnosticSpec(message: "expected identifier in enum")]) // `actor` cannot recover from a missing identifier since it's contextual // based on the presence of the identifier. } @@ -1257,7 +1257,7 @@ final class DeclarationTests: XCTestCase { func testDontNestClassesIfTheyContainUnexpectedTokens() { // There used to be a bug where `class B` was parsed as a nested class of A // because recovery to the `class` keyword of B consumed the closing brace. - AssertParse( + assertParse( """ class A { 1️⃣^2️⃣ @@ -1319,7 +1319,7 @@ final class DeclarationTests: XCTestCase { } func testIssue1025() { - AssertParse( + assertParse( """ struct Math { public static let pi = 3.14 @@ -1328,11 +1328,11 @@ final class DeclarationTests: XCTestCase { """ ) - AssertParse("func foo(body: (isolated String) -> Int) {}") + assertParse("func foo(body: (isolated String) -> Int) {}") } func testMacroDecl() { - AssertParse( + assertParse( """ macro m1: Int = A.M1 macro m2(_: Int) = A.M2 @@ -1342,7 +1342,7 @@ final class DeclarationTests: XCTestCase { """ ) - AssertParse( + assertParse( """ macro m1 1️⃣= A """, @@ -1353,7 +1353,7 @@ final class DeclarationTests: XCTestCase { } func testPrimaryAssociatedTypeNotTerminatedWithAngleBracket() { - AssertParse( + assertParse( "protocol1️⃣<2️⃣:3️⃣", diagnostics: [ DiagnosticSpec(locationMarker: "1️⃣", message: "expected identifier in protocol"), @@ -1366,7 +1366,7 @@ final class DeclarationTests: XCTestCase { } func testClassWithPrivateSet() { - AssertParse( + assertParse( """ struct Properties { class private(set) var privateSetterCustomNames: Bool @@ -1376,7 +1376,7 @@ final class DeclarationTests: XCTestCase { } func testEditorPlaceholderInMemberDeclList() { - AssertParse( + assertParse( """ class Foo { <#code#> @@ -1389,7 +1389,7 @@ final class DeclarationTests: XCTestCase { } func testAttributeInPoundIf() { - AssertParse( + assertParse( """ #if hasAttribute(foo) @foo @@ -1400,7 +1400,7 @@ final class DeclarationTests: XCTestCase { } func testMissingExpressionInVariableAssignment() { - AssertParse( + assertParse( """ let a =1️⃣ """, @@ -1414,7 +1414,7 @@ final class DeclarationTests: XCTestCase { } func testCallToOpenThatLooksLikeDeclarationModifier() { - AssertParse( + assertParse( """ func test() { open(set) @@ -1439,7 +1439,7 @@ final class DeclarationTests: XCTestCase { func testReferenceToOpenThatLooksLikeDeclarationModifier() { // Ideally, this should be parsed as an identifier expression to 'open', // followed by a variable declaration but the current behavior matches the C++ parser. - AssertParse( + assertParse( """ func test() { open @@ -1466,7 +1466,7 @@ final class DeclarationTests: XCTestCase { } func testOpenVarInCodeBlockItemList() { - AssertParse( + assertParse( """ func test() { open var foo = 2 @@ -1477,7 +1477,7 @@ final class DeclarationTests: XCTestCase { } func testAsyncLetInLocalContext() { - AssertParse( + assertParse( """ func foo() async { async let x: String = "x" @@ -1487,7 +1487,7 @@ final class DeclarationTests: XCTestCase { } func testBorrowingConsumingParameterSpecifiers() { - AssertParse( + assertParse( """ struct borrowing {} struct consuming {} @@ -1536,7 +1536,7 @@ final class DeclarationTests: XCTestCase { // A function type in the where clause isn't semantically valid but its fine // with the parser. Make sure we don't recover to the arrow to parse the // function return type. - AssertParse( + assertParse( """ func badTypeConformance3(_: T) where (T) -> () : EqualComparable { } """ diff --git a/Tests/SwiftParserTest/DirectiveTests.swift b/Tests/SwiftParserTest/DirectiveTests.swift index 5af4053f8c6..68a557e5ffb 100644 --- a/Tests/SwiftParserTest/DirectiveTests.swift +++ b/Tests/SwiftParserTest/DirectiveTests.swift @@ -16,7 +16,7 @@ import XCTest final class DirectiveTests: XCTestCase { func testSwitchIfConfig() { - AssertParse( + assertParse( """ switch x { case 1: fallthrough @@ -41,7 +41,7 @@ final class DirectiveTests: XCTestCase { } func testPostfixIfConfigExpression() { - AssertParse( + assertParse( """ foo .bar() @@ -70,7 +70,7 @@ final class DirectiveTests: XCTestCase { } func testPostfixIfConfigExpressionContainsPoundIf() { - AssertParse( + assertParse( """ b #if true @@ -86,19 +86,19 @@ final class DirectiveTests: XCTestCase { } func testSourceLocation() { - AssertParse( + assertParse( """ #sourceLocation() """ ) - AssertParse( + assertParse( """ #sourceLocation(file: "foo", line: 42) """ ) - AssertParse( + assertParse( """ public class C { @@ -114,7 +114,7 @@ final class DirectiveTests: XCTestCase { } public func testUnterminatedPoundIf() { - AssertParse( + assertParse( "#if test1️⃣", diagnostics: [ DiagnosticSpec(message: "expected '#endif' in conditional compilation block") @@ -123,7 +123,7 @@ final class DirectiveTests: XCTestCase { } func testExtraSyntaxInDirective() { - AssertParse( + assertParse( """ #if os(iOS) func foo() {} @@ -141,7 +141,7 @@ final class DirectiveTests: XCTestCase { } func testHasAttribute() { - AssertParse( + assertParse( """ @frozen #if hasAttribute(foo) @@ -151,7 +151,7 @@ final class DirectiveTests: XCTestCase { """ ) - AssertParse( + assertParse( """ struct Inner { @frozen diff --git a/Tests/SwiftParserTest/ExpressionTests.swift b/Tests/SwiftParserTest/ExpressionTests.swift index cbf384adfec..f62673be7c4 100644 --- a/Tests/SwiftParserTest/ExpressionTests.swift +++ b/Tests/SwiftParserTest/ExpressionTests.swift @@ -16,15 +16,15 @@ import XCTest final class ExpressionTests: XCTestCase { func testTernary() { - AssertParse( + assertParse( "let a =1️⃣", diagnostics: [ DiagnosticSpec(message: "expected expression in variable") ] ) - AssertParse("a ? b : c ? d : e") - AssertParse( + assertParse("a ? b : c ? d : e") + assertParse( "a ? b :1️⃣", diagnostics: [ DiagnosticSpec(message: "expected expression after ternary operator") @@ -33,19 +33,19 @@ final class ExpressionTests: XCTestCase { } func testSequence() { - AssertParse( + assertParse( "A as? B + C -> D is E as! F ? G = 42 : H" ) } func testClosureLiterals() { - AssertParse( + assertParse( #""" { @MainActor (a: Int) async -> Int in print("hi") } """# ) - AssertParse( + assertParse( """ { [weak self, weak weakB = b] foo in return 0 @@ -55,7 +55,7 @@ final class ExpressionTests: XCTestCase { } func testTrailingClosures() { - AssertParse( + assertParse( """ var button = View.Button[5, 4, 3 ] { @@ -65,12 +65,12 @@ final class ExpressionTests: XCTestCase { """ ) - AssertParse("compactMap { (parserDiag) in }") + assertParse("compactMap { (parserDiag) in }") } func testSequenceExpressions() { - AssertParse("await a()") - AssertParse( + assertParse("await a()") + assertParse( """ async let child = testNestedTaskPriority(basePri: basePri, curPri: curPri) await child @@ -79,11 +79,11 @@ final class ExpressionTests: XCTestCase { } func testNestedTypeSpecialization() { - AssertParse("Swift.Array>()") + assertParse("Swift.Array>()") } func testObjectLiterals() { - AssertParse( + assertParse( """ #colorLiteral() #colorLiteral(red: 1.0) @@ -92,7 +92,7 @@ final class ExpressionTests: XCTestCase { """ ) - AssertParse( + assertParse( """ #imageLiteral() #imageLiteral(resourceName: "foo.png") @@ -103,7 +103,7 @@ final class ExpressionTests: XCTestCase { } func testKeypathExpression() { - AssertParse( + assertParse( #""" \.?.foo """#, @@ -138,13 +138,13 @@ final class ExpressionTests: XCTestCase { ) ) - AssertParse( + assertParse( #""" children.filter(\.type.defaultInitialization.isEmpty) """# ) - AssertParse( + assertParse( #""" \a cℹ️[1️⃣ @@ -154,79 +154,79 @@ final class ExpressionTests: XCTestCase { ] ) - AssertParse( + assertParse( #""" _ = \Lens<[Int]>.[0] """# ) - AssertParse( + assertParse( #""" \(UnsafeRawPointer?, String).1 """# ) - AssertParse( + assertParse( #""" \a.b.c """# ) - AssertParse( + assertParse( #""" \ABCProtocol[100] """# ) - AssertParse( + assertParse( #""" \S.x """# ) - AssertParse( + assertParse( #""" \TupleProperties.self """# ) - AssertParse( + assertParse( #""" \Tuple.self """# ) - AssertParse( + assertParse( #""" \T.extension """# ) - AssertParse( + assertParse( #""" \T.12[14] """# ) - AssertParse( + assertParse( #""" \String?.!.count.? """# ) - AssertParse( + assertParse( #""" \Optional.?!?!?!? """# ) - AssertParse( + assertParse( #""" \Optional.?!?!?!?.??! """# ) - AssertParse( + assertParse( #""" _ = distinctUntilChanged(\ .?.status) _ = distinctUntilChanged(\.?.status) @@ -261,7 +261,7 @@ final class ExpressionTests: XCTestCase { for (line, rootType) in cases { var parser = Parser(rootType) - AssertParse( + assertParse( "\\\(rootType).y", ExprSyntax.parse, substructure: Syntax( @@ -283,7 +283,7 @@ final class ExpressionTests: XCTestCase { } func testBasicLiterals() { - AssertParse( + assertParse( """ #file #fileID @@ -305,7 +305,7 @@ final class ExpressionTests: XCTestCase { } func testRegexLiteral() { - AssertParse( + assertParse( #""" /(?[[:alpha:]]\w*) = (?[0-9A-F]+)/ """# @@ -313,19 +313,19 @@ final class ExpressionTests: XCTestCase { } func testInitializerExpression() { - AssertParse("Lexer.Cursor(input: input, previous: 0)") + assertParse("Lexer.Cursor(input: input, previous: 0)") } func testCollectionLiterals() { - AssertParse("[Dictionary: Int]()") - AssertParse("[(Int, Double) -> Bool]()") - AssertParse("[(Int, Double) -> Bool]()") - AssertParse("_ = [@convention(block) () -> Int]().count") - AssertParse("A<@convention(c) () -> Int32>.c()") - AssertParse("A<(@autoclosure @escaping () -> Int, Int) -> Void>.c()") - AssertParse("_ = [String: (@escaping (A) -> Int) -> Void]().keys") + assertParse("[Dictionary: Int]()") + assertParse("[(Int, Double) -> Bool]()") + assertParse("[(Int, Double) -> Bool]()") + assertParse("_ = [@convention(block) () -> Int]().count") + assertParse("A<@convention(c) () -> Int32>.c()") + assertParse("A<(@autoclosure @escaping () -> Int, Int) -> Void>.c()") + assertParse("_ = [String: (@escaping (A) -> Int) -> Void]().keys") - AssertParse( + assertParse( """ [ condition ? firstOption : secondOption, @@ -334,7 +334,7 @@ final class ExpressionTests: XCTestCase { """ ) - AssertParse( + assertParse( """ [1️⃣ ,2️⃣ @@ -345,7 +345,7 @@ final class ExpressionTests: XCTestCase { ] ) - AssertParse( + assertParse( """ ([1:1️⃣) """, @@ -355,7 +355,7 @@ final class ExpressionTests: XCTestCase { ] ) - AssertParse( + assertParse( """ [ #line : Calendar(identifier: .gregorian), @@ -391,7 +391,7 @@ final class ExpressionTests: XCTestCase { substructureAfterMarker: "1️⃣" ) - AssertParse( + assertParse( """ #fancyMacro(hello: "me") """ @@ -399,19 +399,19 @@ final class ExpressionTests: XCTestCase { } func testInterpolatedStringLiterals() { - AssertParse( + assertParse( #""" return "Fixit: \(range.debugDescription) Text: \"\(text)\"" """# ) - AssertParse( + assertParse( #""" "text \(array.map({ "\($0)" }).joined(separator: ",")) text" """# ) - AssertParse( + assertParse( #""" """ \(gen(xx) { (x) in @@ -423,7 +423,7 @@ final class ExpressionTests: XCTestCase { """# ) - AssertParse( + assertParse( #""" "\(()1️⃣ """#, @@ -435,26 +435,26 @@ final class ExpressionTests: XCTestCase { } func testStringLiterals() { - AssertParse( + assertParse( #""" "–" """# ) - AssertParse( + assertParse( #""" "" """# ) - AssertParse( + assertParse( #""" """ """ """# ) - AssertParse( + assertParse( #""" " >> \( abc 1️⃣} ) << " """#, @@ -463,7 +463,7 @@ final class ExpressionTests: XCTestCase { ] ) - AssertParse( + assertParse( ##""" @@ -475,7 +475,7 @@ final class ExpressionTests: XCTestCase { """## ) - AssertParse( + assertParse( #""" ℹ️"\",1️⃣ """#, @@ -489,7 +489,7 @@ final class ExpressionTests: XCTestCase { ] ) - AssertParse( + assertParse( #""" "(?i)\\b((?:[a-z][\\w-]+:(?:/{1,3}|[a-z0-9%])|www\\d{0,3}[.]|[a-z0-9.\\-]+[.][a-z]{2,4}/)" + "(?:[^\\s()<>]+|\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\))+(?:\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*" + @@ -497,7 +497,7 @@ final class ExpressionTests: XCTestCase { """# ) - AssertParse( + assertParse( #""" """ Custom(custom: \(interval),\ @@ -508,32 +508,32 @@ final class ExpressionTests: XCTestCase { """# ) - AssertParse( + assertParse( #""" "Founded: \(Date.appleFounding, format: 📆)" """# ) - AssertParse( + assertParse( """ "" """ ) - AssertParse( + assertParse( ##""" #"""# """## ) - AssertParse( + assertParse( ##""" #"""""# """## ) - AssertParse( + assertParse( ##""" #""" multiline raw @@ -541,13 +541,13 @@ final class ExpressionTests: XCTestCase { """## ) - AssertParse( + assertParse( #""" "\(x)" """# ) - AssertParse( + assertParse( ##""" ℹ️""""1️⃣ """##, @@ -561,7 +561,7 @@ final class ExpressionTests: XCTestCase { ] ) - AssertParse( + assertParse( ##""" """""1️⃣ """##, @@ -570,7 +570,7 @@ final class ExpressionTests: XCTestCase { ] ) - AssertParse( + assertParse( ##""" """1️⃣""" """##, @@ -583,7 +583,7 @@ final class ExpressionTests: XCTestCase { """## ) - AssertParse( + assertParse( ##""" #"1️⃣ """##, @@ -592,7 +592,7 @@ final class ExpressionTests: XCTestCase { ] ) - AssertParse( + assertParse( ##""" #"""1️⃣ """##, @@ -601,7 +601,7 @@ final class ExpressionTests: XCTestCase { ] ) - AssertParse( + assertParse( ##""" #"""a1️⃣ """##, @@ -610,7 +610,7 @@ final class ExpressionTests: XCTestCase { ] ) - AssertParse( + assertParse( ###""1️⃣\2️⃣"###, diagnostics: [ DiagnosticSpec(locationMarker: "1️⃣", message: "invalid escape sequence in literal"), @@ -620,14 +620,14 @@ final class ExpressionTests: XCTestCase { } func testAdjacentRawStringLiterals() { - AssertParse( + assertParse( """ "normal literal" #"raw literal"# """ ) - AssertParse( + assertParse( """ #"raw literal"# #"second raw literal"# @@ -636,7 +636,7 @@ final class ExpressionTests: XCTestCase { } func testSingleQuoteStringLiteral() { - AssertParse( + assertParse( #""" 1️⃣'red' """#, @@ -648,7 +648,7 @@ final class ExpressionTests: XCTestCase { """ ) - AssertParse( + assertParse( #""" 1️⃣' red ' + 1 """#, @@ -662,7 +662,7 @@ final class ExpressionTests: XCTestCase { } func testStringBogusClosingDelimiters() { - AssertParse( + assertParse( ##""" \1️⃣\(2️⃣ """##, @@ -672,13 +672,13 @@ final class ExpressionTests: XCTestCase { ] ) - AssertParse( + assertParse( ##""" #"\\("# """## ) - AssertParse( + assertParse( #""" "1️⃣ """#, @@ -687,7 +687,7 @@ final class ExpressionTests: XCTestCase { ] ) - AssertParse( + assertParse( #""" "'1️⃣ """#, @@ -698,7 +698,7 @@ final class ExpressionTests: XCTestCase { } func testPoundsInStringInterpolationWhereNotNecessary() { - AssertParse( + assertParse( ##""" "1️⃣\#(1)" """##, @@ -710,13 +710,13 @@ final class ExpressionTests: XCTestCase { } func testSubscript() { - AssertParse( + assertParse( """ array[] """ ) - AssertParse( + assertParse( """ text[...] """ @@ -724,7 +724,7 @@ final class ExpressionTests: XCTestCase { } func testMissingColonInTernary() { - AssertParse( + assertParse( "foo ? 11️⃣", diagnostics: [ DiagnosticSpec(message: "expected ':' and expression after '? ...' in ternary expression") @@ -733,7 +733,7 @@ final class ExpressionTests: XCTestCase { } func testBogusKeypathBaseRecovery() { - AssertParse( + assertParse( #""" func nestThoseIfs() { \n @@ -749,7 +749,7 @@ final class ExpressionTests: XCTestCase { ] ) - AssertParse( + assertParse( "#keyPath((b:1️⃣)2️⃣", diagnostics: [ DiagnosticSpec(locationMarker: "1️⃣", message: "expected value in tuple"), @@ -759,7 +759,7 @@ final class ExpressionTests: XCTestCase { } func testMissingArrowInArrowExpr() { - AssertParse( + assertParse( "[(Int) -> 1️⃣throws Int]()", diagnostics: [ DiagnosticSpec(message: "'throws' must preceed '->'", fixIts: ["move 'throws' in front of '->'"]) @@ -767,7 +767,7 @@ final class ExpressionTests: XCTestCase { fixedSource: "[(Int) throws -> Int]()" ) - AssertParse( + assertParse( "[(Int) -> 1️⃣async throws Int]()", diagnostics: [ DiagnosticSpec(message: "'async throws' must preceed '->'", fixIts: ["move 'async throws' in front of '->'"]) @@ -775,7 +775,7 @@ final class ExpressionTests: XCTestCase { fixedSource: "[(Int) async throws -> Int]()" ) - AssertParse( + assertParse( "let _ = [Int throws 1️⃣Int]()", diagnostics: [ DiagnosticSpec(message: "expected '->' in array element") @@ -784,7 +784,7 @@ final class ExpressionTests: XCTestCase { } func testBogusThrowingTernary() { - AssertParse( + assertParse( """ do { true ? () : 1️⃣throw opaque_error() @@ -798,7 +798,7 @@ final class ExpressionTests: XCTestCase { } func testClosureExpression() { - AssertParse( + assertParse( """ let 1️⃣:(2️⃣..)->3️⃣ """, @@ -812,7 +812,7 @@ final class ExpressionTests: XCTestCase { } func testParseArrowExpr() { - AssertParse( + assertParse( "Foo 1️⃣async ->2️⃣", { ExprSyntax.parse(from: &$0) }, substructure: Syntax(TokenSyntax.keyword(.async)), @@ -824,27 +824,27 @@ final class ExpressionTests: XCTestCase { } func testMoveExpression() { - AssertParse("_move msg") - AssertParse("use(_move msg)") - AssertParse("_move msg") - AssertParse("let b = (_move self).buffer") + assertParse("_move msg") + assertParse("use(_move msg)") + assertParse("_move msg") + assertParse("let b = (_move self).buffer") } func testBorrowExpression() { - AssertParse("_borrow msg") - AssertParse("use(_borrow msg)") - AssertParse("_borrow msg") - AssertParse("let b = (_borrow self).buffer") + assertParse("_borrow msg") + assertParse("use(_borrow msg)") + assertParse("_borrow msg") + assertParse("let b = (_borrow self).buffer") } func testCodeCompletionExpressions() { - AssertParse("if !<#b1#> && !<#b2#> {}") - AssertParse("if <#test#> {}") - AssertParse("if <#b1#>, <#b2#> {}") + assertParse("if !<#b1#> && !<#b2#> {}") + assertParse("if <#test#> {}") + assertParse("if <#b1#>, <#b2#> {}") } func testKeywordApplyExpression() { - AssertParse( + assertParse( """ optional(x: .some(23)) optional(x: .none) @@ -858,7 +858,7 @@ final class ExpressionTests: XCTestCase { // // See https://github.com/apple/swift/issues/51192 for more context here. func testFalseMultilineDelimiters() { - AssertParse( + assertParse( ###""" _ = #"​"​"# @@ -874,7 +874,7 @@ final class ExpressionTests: XCTestCase { } func testOperatorReference() { - AssertParse( + assertParse( "reduce(0, 1️⃣+)", substructure: Syntax(TokenSyntax.binaryOperator("+")), substructureAfterMarker: "1️⃣" @@ -885,7 +885,7 @@ final class ExpressionTests: XCTestCase { // N.B. This test ensures that capture list lookahead doesn't try to pair // the opening square bracket from the array literal with the closing // square bracket from the capture list. - AssertParse( + assertParse( """ { [ @@ -900,15 +900,15 @@ final class ExpressionTests: XCTestCase { } func testMacroExpansionExpression() { - AssertParse( + assertParse( #"#file == $0.path"# ) - AssertParse( + assertParse( #"let a = #embed("filename.txt")"# ) - AssertParse( + assertParse( """ #Test { print("This is a test") @@ -918,7 +918,7 @@ final class ExpressionTests: XCTestCase { } func testNewlineInInterpolationOfSingleLineString() { - AssertParse( + assertParse( #""" "test \(label:1️⃣ foo2️⃣)" @@ -933,7 +933,7 @@ final class ExpressionTests: XCTestCase { } func testUnterminatedStringLiteral() { - AssertParse( + assertParse( """ "This is unterminated1️⃣ x @@ -954,7 +954,7 @@ final class ExpressionTests: XCTestCase { } func testPostProcessMultilineStringLiteral() { - AssertParse( + assertParse( #""" """ line 1 @@ -974,7 +974,7 @@ final class ExpressionTests: XCTestCase { options: [.substructureCheckTrivia] ) - AssertParse( + assertParse( #""" """ line 1 \ @@ -994,7 +994,7 @@ final class ExpressionTests: XCTestCase { options: [.substructureCheckTrivia] ) - AssertParse( + assertParse( #""" """ line 1 @@ -1025,7 +1025,7 @@ final class ExpressionTests: XCTestCase { func testMultiLineStringInInterpolationOfSingleLineStringLiteral() { // It's odd that we accept this but it matches the C++ parser's behavior. - AssertParse( + assertParse( #""" "foo\(test(""" bar @@ -1035,7 +1035,7 @@ final class ExpressionTests: XCTestCase { } func testEmptyLineInMultilineStringLiteral() { - AssertParse( + assertParse( #""" """ line 1 @@ -1059,7 +1059,7 @@ final class ExpressionTests: XCTestCase { options: [.substructureCheckTrivia] ) - AssertParse( + assertParse( #""" """ line 1 @@ -1083,7 +1083,7 @@ final class ExpressionTests: XCTestCase { } func testUnderIndentedWhitespaceonlyLineInMultilineStringLiteral() { - AssertParse( + assertParse( #""" """ line 1 @@ -1105,7 +1105,7 @@ final class ExpressionTests: XCTestCase { } func testMissingExpresssionInSequenceExpression() { - AssertParse( + assertParse( """ a ? b :1️⃣ """, @@ -1117,7 +1117,7 @@ final class ExpressionTests: XCTestCase { """ ) - AssertParse( + assertParse( """ a +1️⃣ """, @@ -1129,7 +1129,7 @@ final class ExpressionTests: XCTestCase { """ ) - AssertParse( + assertParse( """ a as1️⃣ """, @@ -1141,7 +1141,7 @@ final class ExpressionTests: XCTestCase { """ ) - AssertParse( + assertParse( """ a is1️⃣ """, @@ -1155,7 +1155,7 @@ final class ExpressionTests: XCTestCase { } func testNonBreakingSpace() { - AssertParse( + assertParse( "a 1️⃣\u{a0}+ 2", diagnostics: [ DiagnosticSpec(message: "non-breaking space (U+00A0) used instead of regular space", severity: .warning, fixIts: ["replace non-breaking space with ' '"]) @@ -1165,7 +1165,7 @@ final class ExpressionTests: XCTestCase { } func testTabsIndentationInMultilineStringLiteral() { - AssertParse( + assertParse( #""" _ = """ \#taq @@ -1175,7 +1175,7 @@ final class ExpressionTests: XCTestCase { } func testMixedIndentationInMultilineStringLiteral() { - AssertParse( + assertParse( #""" _ = """ \#t aq @@ -1185,7 +1185,7 @@ final class ExpressionTests: XCTestCase { } func testNulCharacterInSourceFile() { - AssertParse( + assertParse( "let a = 1️⃣\u{0}1", diagnostics: [ DiagnosticSpec(message: "nul character embedded in middle of file", severity: .warning) @@ -1204,7 +1204,7 @@ final class MemberExprTests: XCTestCase { #line: "\n member", ] for (line, trailing) in cases { - AssertParse( + assertParse( "someVar.1️⃣\(trailing)", diagnostics: [DiagnosticSpec(message: "expected name in member access")], fixedSource: "someVar.<#identifier#>\(trailing)", @@ -1280,7 +1280,7 @@ final class StatementExpressionTests: XCTestCase { ) } func testIfExprInCoercion() { - AssertParse( + assertParse( """ func foo() { if .random() { 0 } else { 1 } as Int @@ -1302,7 +1302,7 @@ final class StatementExpressionTests: XCTestCase { ) } func testSwitchExprInCoercion() { - AssertParse( + assertParse( """ switch Bool.random() { case true: 0 case false: 1 } as Int """, @@ -1322,7 +1322,7 @@ final class StatementExpressionTests: XCTestCase { ) } func testIfExprInReturn() { - AssertParse( + assertParse( """ func foo() { return if .random() { 0 } else { 1 } @@ -1334,7 +1334,7 @@ final class StatementExpressionTests: XCTestCase { ) } func testSwitchExprInReturn() { - AssertParse( + assertParse( """ func foo() { return switch Bool.random() { case true: 0 case false: 1 } @@ -1346,7 +1346,7 @@ final class StatementExpressionTests: XCTestCase { ) } func testTryIf1() { - AssertParse( + assertParse( """ func foo() -> Int { try if .random() { 0 } else { 1 } @@ -1358,7 +1358,7 @@ final class StatementExpressionTests: XCTestCase { ) } func testTryIf2() { - AssertParse( + assertParse( """ func foo() -> Int { return try if .random() { 0 } else { 1 } @@ -1370,7 +1370,7 @@ final class StatementExpressionTests: XCTestCase { ) } func testTryIf3() { - AssertParse( + assertParse( """ func foo() -> Int { let x = try if .random() { 0 } else { 1 } @@ -1383,7 +1383,7 @@ final class StatementExpressionTests: XCTestCase { ) } func testAwaitIf1() { - AssertParse( + assertParse( """ func foo() async -> Int { await if .random() { 0 } else { 1 } @@ -1395,7 +1395,7 @@ final class StatementExpressionTests: XCTestCase { ) } func testAwaitIf2() { - AssertParse( + assertParse( """ func foo() async -> Int { return await if .random() { 0 } else { 1 } @@ -1407,7 +1407,7 @@ final class StatementExpressionTests: XCTestCase { ) } func testAwaitIf3() { - AssertParse( + assertParse( """ func foo() async -> Int { let x = await if .random() { 0 } else { 1 } @@ -1420,7 +1420,7 @@ final class StatementExpressionTests: XCTestCase { ) } func testTrySwitch1() { - AssertParse( + assertParse( """ try switch Bool.random() { case true: 0 case false: 1 } """, @@ -1430,7 +1430,7 @@ final class StatementExpressionTests: XCTestCase { ) } func testTrySwitch2() { - AssertParse( + assertParse( """ func foo() -> Int { return try switch Bool.random() { case true: 0 case false: 1 } @@ -1442,7 +1442,7 @@ final class StatementExpressionTests: XCTestCase { ) } func testTrySwitch3() { - AssertParse( + assertParse( """ func foo() -> Int { let x = try switch Bool.random() { case true: 0 case false: 1 } @@ -1455,7 +1455,7 @@ final class StatementExpressionTests: XCTestCase { ) } func testAwaitSwitch1() { - AssertParse( + assertParse( """ await switch Bool.random() { case true: 0 case false: 1 } """, @@ -1465,7 +1465,7 @@ final class StatementExpressionTests: XCTestCase { ) } func testAwaitSwitch2() { - AssertParse( + assertParse( """ func foo() async -> Int { return await switch Bool.random() { case true: 0 case false: 1 } @@ -1477,7 +1477,7 @@ final class StatementExpressionTests: XCTestCase { ) } func testAwaitSwitch3() { - AssertParse( + assertParse( """ func foo() async -> Int { let x = await switch Bool.random() { case true: 0 case false: 1 } @@ -1492,7 +1492,7 @@ final class StatementExpressionTests: XCTestCase { func testIfExprMultipleCoerce() { // We only allow coercions as a narrow case in the parser, so attempting to // double them up is invalid. - AssertParse( + assertParse( """ func foo() { if .random() { 0 } else { 1 } as Int 1️⃣as Int @@ -1505,7 +1505,7 @@ final class StatementExpressionTests: XCTestCase { } func testIfExprIs() { // We don't parse 'is Int'. - AssertParse( + assertParse( """ func foo() -> Bool { if .random() { 0 } else { 1 } 1️⃣is Int @@ -1518,7 +1518,7 @@ final class StatementExpressionTests: XCTestCase { } func testIfExprCondCast() { // We parse 'as? Int', but it will be a semantic error. - AssertParse( + assertParse( """ if .random() { 0 } else { 1 } as? Int """, @@ -1539,7 +1539,7 @@ final class StatementExpressionTests: XCTestCase { } func testIfExprForceCast() { // We parse 'as! Int', but it will be a semantic error. - AssertParse( + assertParse( """ if .random() { 0 } else { 1 } as! Int """, @@ -1561,7 +1561,7 @@ final class StatementExpressionTests: XCTestCase { func testSwitchExprMultipleCoerce() { // We only allow coercions as a narrow case in the parser, so attempting to // double them up is invalid. - AssertParse( + assertParse( """ func foo() { switch Bool.random() { case true: 0 case false: 1 } as Int 1️⃣as Int @@ -1574,7 +1574,7 @@ final class StatementExpressionTests: XCTestCase { } func testSwitchExprIs() { // We don't parse 'is Int'. - AssertParse( + assertParse( """ func foo() -> Bool { switch Bool.random() { case true: 0 case false: 1 } 1️⃣is Int @@ -1587,7 +1587,7 @@ final class StatementExpressionTests: XCTestCase { } func testSwitchExprCondCast() { // We parse 'as? Int', but it will be a semantic error. - AssertParse( + assertParse( """ switch Bool.random() { case true: 0 case false: 1 } as? Int """, @@ -1608,7 +1608,7 @@ final class StatementExpressionTests: XCTestCase { } func testSwitchExprForceCast() { // We parse 'as! Int', but it will be a semantic error. - AssertParse( + assertParse( """ switch Bool.random() { case true: 0 case false: 1 } as! Int """, @@ -1629,7 +1629,7 @@ final class StatementExpressionTests: XCTestCase { } func testPatternExprInSwitchCaseItem() { - AssertParse( + assertParse( """ switch x { case a: @@ -1643,7 +1643,7 @@ final class StatementExpressionTests: XCTestCase { } func testStandaloneAtCaseInSwitch() { - AssertParse( + assertParse( """ switch x { 1️⃣@case @@ -1654,7 +1654,7 @@ final class StatementExpressionTests: XCTestCase { } func testUnterminatedInterpolationAtEndOfMultilineStringLiteral() { - AssertParse( + assertParse( #""" """1️⃣\({(2️⃣}) """ @@ -1667,7 +1667,7 @@ final class StatementExpressionTests: XCTestCase { } func testUnterminatedString1() { - AssertParse( + assertParse( #""" "abc1️⃣ "2️⃣ @@ -1680,7 +1680,7 @@ final class StatementExpressionTests: XCTestCase { } func testUnterminatedString2() { - AssertParse( + assertParse( #""" "1️⃣ "2️⃣ @@ -1693,7 +1693,7 @@ final class StatementExpressionTests: XCTestCase { } func testUnterminatedString3() { - AssertParse( + assertParse( #""" "abc1️⃣ \(def)2️⃣"3️⃣ @@ -1707,7 +1707,7 @@ final class StatementExpressionTests: XCTestCase { } func testUnterminatedString4() { - AssertParse( + assertParse( #""" "abc\(def1️⃣2️⃣ 3️⃣)" @@ -1721,7 +1721,7 @@ final class StatementExpressionTests: XCTestCase { } func testUnterminatedString5() { - AssertParse( + assertParse( #""" "abc\(1️⃣2️⃣ def3️⃣)" @@ -1735,7 +1735,7 @@ final class StatementExpressionTests: XCTestCase { } func testUnterminatedString6() { - AssertParse( + assertParse( #""" "abc1️⃣\2️⃣ (def)3️⃣"4️⃣ @@ -1750,7 +1750,7 @@ final class StatementExpressionTests: XCTestCase { } func testUnterminatedString7() { - AssertParse( + assertParse( #""" #1️⃣ "abc"2️⃣#3️⃣ @@ -1764,7 +1764,7 @@ final class StatementExpressionTests: XCTestCase { } func testUnterminatedString8() { - AssertParse( + assertParse( #""" #"1️⃣ abc2️⃣"#3️⃣ @@ -1778,7 +1778,7 @@ final class StatementExpressionTests: XCTestCase { } func testUnterminatedString9() { - AssertParse( + assertParse( #""" #"abc1️⃣ "#2️⃣ @@ -1791,7 +1791,7 @@ final class StatementExpressionTests: XCTestCase { } func testUnterminatedString10() { - AssertParse( + assertParse( #""" #"abc"1️⃣ #2️⃣ @@ -1804,7 +1804,7 @@ final class StatementExpressionTests: XCTestCase { } func testTriviaEndingInterpolation() { - AssertParse( + assertParse( #""" "abc\(def )" """# @@ -1812,7 +1812,7 @@ final class StatementExpressionTests: XCTestCase { } func testStringLiteralAfterKeyPath() { - AssertParse( + assertParse( #""" \String.?1️⃣"" """#, diff --git a/Tests/SwiftParserTest/ExpressionTypeTests.swift b/Tests/SwiftParserTest/ExpressionTypeTests.swift index 826992be2ca..4dcd46a67e2 100644 --- a/Tests/SwiftParserTest/ExpressionTypeTests.swift +++ b/Tests/SwiftParserTest/ExpressionTypeTests.swift @@ -15,7 +15,7 @@ import XCTest final class ExpressionTypeTests: XCTestCase { func testTypeExpression() { - AssertParse("_ = (any Sequence).self") + assertParse("_ = (any Sequence).self") } /// Test that `canParseType()` succeeds for these generic arguments. @@ -72,7 +72,7 @@ final class ExpressionTypeTests: XCTestCase { ] for (line, type) in cases { - AssertParse( + assertParse( "G<\(type)>.self", ExprSyntax.parse, substructure: Syntax(SimpleTypeIdentifierSyntax(name: .identifier("X"))), @@ -82,7 +82,7 @@ final class ExpressionTypeTests: XCTestCase { } // Void - AssertParse( + assertParse( "G<1️⃣()>.self", ExprSyntax.parse, substructure: Syntax(TupleTypeSyntax(elements: .init([]))), @@ -90,7 +90,7 @@ final class ExpressionTypeTests: XCTestCase { ) // Any - AssertParse( + assertParse( "G<1️⃣Any>.self", ExprSyntax.parse, substructure: Syntax(SimpleTypeIdentifierSyntax(name: .keyword(.Any))), @@ -98,7 +98,7 @@ final class ExpressionTypeTests: XCTestCase { ) // Self - AssertParse( + assertParse( "G<1️⃣Self>.self", ExprSyntax.parse, substructure: Syntax(SimpleTypeIdentifierSyntax(name: .keyword(.Self))), diff --git a/Tests/SwiftParserTest/LexerTests.swift b/Tests/SwiftParserTest/LexerTests.swift index 571ad46ec48..e3274f9a3c2 100644 --- a/Tests/SwiftParserTest/LexerTests.swift +++ b/Tests/SwiftParserTest/LexerTests.swift @@ -32,7 +32,7 @@ fileprivate func lex(_ sourceBytes: [UInt8], body: ([Lexer.Lexeme]) throws -> Vo /// values for trivia and text. While this is good for most cases, string /// literals can't contain invalid UTF-8. Thus, we need a different assert /// function working on byte arrays to test source code containing invalid UTF-8. -fileprivate func AssertRawBytesLexeme( +fileprivate func assertRawBytesLexeme( _ lexeme: Lexer.Lexeme, kind: RawTokenKind, leadingTrivia: [UInt8] = [], @@ -57,7 +57,7 @@ fileprivate func AssertRawBytesLexeme( public class LexerTests: XCTestCase { func testIdentifiers() { - AssertLexemes( + assertLexemes( "Hello World", lexemes: [ LexemeSpec(.identifier, text: "Hello", trailing: " "), @@ -67,7 +67,7 @@ public class LexerTests: XCTestCase { } func testEscapedIdentifiers() { - AssertLexemes( + assertLexemes( "`Hello` `World` `$`", lexemes: [ LexemeSpec(.identifier, text: "`Hello`", trailing: " "), @@ -78,7 +78,7 @@ public class LexerTests: XCTestCase { } func testBlockComments() { - AssertLexemes( + assertLexemes( """ /*/ */ func not_doc5() {} @@ -93,7 +93,7 @@ public class LexerTests: XCTestCase { ] ) - AssertLexemes( + assertLexemes( """ /* */ /**/ @@ -106,7 +106,7 @@ public class LexerTests: XCTestCase { } func testDeepTupleAccess() { - AssertLexemes( + assertLexemes( "x.1.0", lexemes: [ LexemeSpec(.identifier, text: "x"), @@ -119,7 +119,7 @@ public class LexerTests: XCTestCase { } func testUnicodeLiteral() { - AssertLexemes( + assertLexemes( #""" "\u{1234}" """#, @@ -130,7 +130,7 @@ public class LexerTests: XCTestCase { ] ) - AssertLexemes( + assertLexemes( #""" "1️⃣\u{12341234}" """#, @@ -143,69 +143,69 @@ public class LexerTests: XCTestCase { } func testNumberLiterals() { - AssertLexemes( + assertLexemes( "1234567890", lexemes: [ LexemeSpec(.integerLiteral, text: "1234567890") ] ) - AssertLexemes( + assertLexemes( "0b1010101", lexemes: [ LexemeSpec(.integerLiteral, text: "0b1010101") ] ) - AssertLexemes( + assertLexemes( "0xABC", lexemes: [ LexemeSpec(.integerLiteral, text: "0xABC") ] ) - AssertLexemes( + assertLexemes( "1.0", lexemes: [ LexemeSpec(.floatingLiteral, text: "1.0") ] ) - AssertLexemes( + assertLexemes( "1.0e10", lexemes: [ LexemeSpec(.floatingLiteral, text: "1.0e10") ] ) - AssertLexemes( + assertLexemes( "1.0E10", lexemes: [ LexemeSpec(.floatingLiteral, text: "1.0E10") ] ) - AssertLexemes( + assertLexemes( "0xfeed_beef", lexemes: [ LexemeSpec(.integerLiteral, text: "0xfeed_beef") ] ) - AssertLexemes( + assertLexemes( "0xff.0p2", lexemes: [ LexemeSpec(.floatingLiteral, text: "0xff.0p2") ] ) - AssertLexemes( + assertLexemes( "-0xff.0p2", lexemes: [ LexemeSpec(.prefixOperator, text: "-"), LexemeSpec(.floatingLiteral, text: "0xff.0p2"), ] ) - AssertLexemes( + assertLexemes( "+0xff.0p2", lexemes: [ LexemeSpec(.prefixOperator, text: "+"), LexemeSpec(.floatingLiteral, text: "0xff.0p2"), ] ) - AssertLexemes( + assertLexemes( "0x1.921fb4p1", lexemes: [ LexemeSpec(.floatingLiteral, text: "0x1.921fb4p1") @@ -214,7 +214,7 @@ public class LexerTests: XCTestCase { } func testRawStringLiterals() { - AssertLexemes( + assertLexemes( """ ###"this is a ##"raw"## string"### """, @@ -227,7 +227,7 @@ public class LexerTests: XCTestCase { ] ) - AssertLexemes( + assertLexemes( """ #"#"abc"# """, @@ -240,7 +240,7 @@ public class LexerTests: XCTestCase { ] ) - AssertLexemes( + assertLexemes( """ ###"##"abc"### """, @@ -253,7 +253,7 @@ public class LexerTests: XCTestCase { ] ) - AssertLexemes( + assertLexemes( #####""" ##"""abc"#### """#####, @@ -268,7 +268,7 @@ public class LexerTests: XCTestCase { } func testShebang() { - AssertLexemes( + assertLexemes( """ #!/usr/bin/swiftc let x = 42 @@ -283,7 +283,7 @@ public class LexerTests: XCTestCase { } func testDocComment() { - AssertLexemes( + assertLexemes( """ /** hello */ var x: Int @@ -300,7 +300,7 @@ public class LexerTests: XCTestCase { } func testMain() { - AssertLexemes( + assertLexemes( """ /* TestApp */ @main struct TestApp { @@ -334,25 +334,25 @@ public class LexerTests: XCTestCase { } func testRegexLexing() { - AssertLexemes( + assertLexemes( "/abc/", lexemes: [ LexemeSpec(.regexLiteral, text: "/abc/") ] ) - AssertLexemes( + assertLexemes( "#/abc/#", lexemes: [ LexemeSpec(.regexLiteral, text: "#/abc/#") ] ) - AssertLexemes( + assertLexemes( "###/abc/###", lexemes: [ LexemeSpec(.regexLiteral, text: "###/abc/###") ] ) - AssertLexemes( + assertLexemes( """ #/ a @@ -363,37 +363,37 @@ public class LexerTests: XCTestCase { LexemeSpec(.regexLiteral, text: "#/\na\nb\n/#") ] ) - AssertLexemes( + assertLexemes( "#/ \na\nb\n /#", lexemes: [ LexemeSpec(.regexLiteral, text: "#/ \na\nb\n /#") ] ) - AssertLexemes( + assertLexemes( "##/ \na\nb\n /##", lexemes: [ LexemeSpec(.regexLiteral, text: "##/ \na\nb\n /##") ] ) - AssertLexemes( + assertLexemes( "#/abc/def/#", lexemes: [ LexemeSpec(.regexLiteral, text: "#/abc/def/#") ] ) - AssertLexemes( + assertLexemes( "#/abc\\/#def/#", lexemes: [ LexemeSpec(.regexLiteral, text: "#/abc\\/#def/#") ] ) - AssertLexemes( + assertLexemes( "#/abc|#def/#", lexemes: [ LexemeSpec(.regexLiteral, text: "#/abc|#def/#") ] ) - AssertLexemes( + assertLexemes( "#/abc\n/#", lexemes: [ LexemeSpec(.pound, text: "#"), @@ -403,7 +403,7 @@ public class LexerTests: XCTestCase { LexemeSpec(.pound, text: "#"), ] ) - AssertLexemes( + assertLexemes( "#/abc\r/#", lexemes: [ LexemeSpec(.pound, text: "#"), @@ -413,7 +413,7 @@ public class LexerTests: XCTestCase { LexemeSpec(.pound, text: "#"), ] ) - AssertLexemes( + assertLexemes( "/a)/", lexemes: [ LexemeSpec(.prefixOperator, text: "/"), @@ -425,7 +425,7 @@ public class LexerTests: XCTestCase { } func testUnexpectedLexing() { - AssertLexemes( + assertLexemes( "static func 1️⃣�() {}", lexemes: [ LexemeSpec(.keyword, text: "static", trailing: " "), @@ -440,7 +440,7 @@ public class LexerTests: XCTestCase { func testBOMLexing() { let bom: Unicode.Scalar = "\u{feff}" - AssertLexemes( + assertLexemes( "\(bom)Hello", lexemes: [ LexemeSpec(.identifier, leading: "\u{feff}", text: "Hello") @@ -449,7 +449,7 @@ public class LexerTests: XCTestCase { } func testConflictLexing() { - AssertLexemes( + assertLexemes( """ // diff3-style conflict markers @@ -483,7 +483,7 @@ public class LexerTests: XCTestCase { ] ) - AssertLexemes( + assertLexemes( """ // Perforce-style conflict markers @@ -527,7 +527,7 @@ public class LexerTests: XCTestCase { } func testUnicodeStringLiteralLexing() { - AssertLexemes( + assertLexemes( #""" "\\)|[^\\s`!()\\[\\]{};:'\".,<>?«»“”‘’]))" """#, @@ -540,7 +540,7 @@ public class LexerTests: XCTestCase { } func testNotARegex() { - AssertLexemes( + assertLexemes( "min(reduced.count / 2, chunkSize / 2)", lexemes: [ LexemeSpec(.identifier, text: "min"), @@ -557,7 +557,7 @@ public class LexerTests: XCTestCase { LexemeSpec(.rightParen, text: ")"), ] ) - AssertLexemes( + assertLexemes( """ var x: Int { return 0 / @@ -581,7 +581,7 @@ public class LexerTests: XCTestCase { ] ) - AssertLexemes( + assertLexemes( "n /= 2 // foo", lexemes: [ LexemeSpec(.identifier, text: "n", trailing: " "), @@ -590,7 +590,7 @@ public class LexerTests: XCTestCase { ] ) - AssertLexemes( + assertLexemes( "UIColor(white: 216.0/255.0, alpha: 44.0/255.0)", lexemes: [ LexemeSpec(.identifier, text: "UIColor"), @@ -610,7 +610,7 @@ public class LexerTests: XCTestCase { ] ) - AssertLexemes( + assertLexemes( "#/abc|#def/", lexemes: [ LexemeSpec(.pound, text: "#"), @@ -625,7 +625,7 @@ public class LexerTests: XCTestCase { } func testUnicodeReplcementsInStream() { - AssertLexemes( + assertLexemes( "() -> (\u{feff})", lexemes: [ LexemeSpec(.leftParen, text: "("), @@ -636,7 +636,7 @@ public class LexerTests: XCTestCase { ] ) - AssertLexemes( + assertLexemes( "y1️⃣\u{fffe} + z", lexemes: [ LexemeSpec(.identifier, text: "y", trailing: "\u{fffe} ", diagnostic: "invalid character in source file"), @@ -647,7 +647,7 @@ public class LexerTests: XCTestCase { } func testOperators() { - AssertLexemes( + assertLexemes( """ myString=="" """, @@ -662,7 +662,7 @@ public class LexerTests: XCTestCase { } func testEditorPlaceholders() { - AssertLexemes( + assertLexemes( "!<#b1#> && !<#b2#>", lexemes: [ LexemeSpec(.prefixOperator, text: "!"), @@ -673,7 +673,7 @@ public class LexerTests: XCTestCase { ] ) - AssertLexemes( + assertLexemes( "<##>", lexemes: [ LexemeSpec(.identifier, text: "<##>", trailing: "") @@ -682,7 +682,7 @@ public class LexerTests: XCTestCase { } func testCommentAttribution() { - AssertLexemes( + assertLexemes( """ func foo() { // comment // new comment @@ -715,7 +715,7 @@ public class LexerTests: XCTestCase { func testCommentAttribution2() { // Example from https://forums.swift.org/t/changing-comment-trivia-attribution-from-trailing-trivia-to-leading-trivia/50773 - AssertLexemes( + assertLexemes( "/*X_START*/x/*X_END*/ + /*Y_START*/y/*Y_END*/", lexemes: [ LexemeSpec(.identifier, leading: "/*X_START*/", text: "x", trailing: "/*X_END*/ "), @@ -726,42 +726,42 @@ public class LexerTests: XCTestCase { } func testNumericLiteralDiagnostics() { - AssertLexemes( + assertLexemes( " 0x1.01️⃣", lexemes: [LexemeSpec(.integerLiteral, leading: " ", text: "0x1.0", diagnostic: "hexadecimal floating point literal must end with an exponent")] ) - AssertLexemes( + assertLexemes( " 0x1p1️⃣_", lexemes: [LexemeSpec(.floatingLiteral, leading: " ", text: "0x1p_", diagnostic: "'_' is not a valid first character in floating point exponent")] ) - AssertLexemes( + assertLexemes( "01️⃣QWERTY", lexemes: [LexemeSpec(.integerLiteral, text: "0QWERTY", diagnostic: "'Q' is not a valid digit in integer literal")] ) - AssertLexemes( + assertLexemes( "0b1️⃣QWERTY", lexemes: [LexemeSpec(.integerLiteral, text: "0bQWERTY", diagnostic: "'Q' is not a valid binary digit (0 or 1) in integer literal")] ) - AssertLexemes( + assertLexemes( "0x1️⃣QWERTY", lexemes: [LexemeSpec(.integerLiteral, text: "0xQWERTY", diagnostic: "'Q' is not a valid hexadecimal digit (0-9, A-F) in integer literal")] ) - AssertLexemes( + assertLexemes( "0o1️⃣QWERTY", lexemes: [LexemeSpec(.integerLiteral, text: "0oQWERTY", diagnostic: "'Q' is not a valid octal digit (0-7) in integer literal")] ) - AssertLexemes( + assertLexemes( "1.0e+1️⃣QWERTY", lexemes: [LexemeSpec(.floatingLiteral, text: "1.0e+QWERTY", diagnostic: "'Q' is not a valid digit in floating point exponent")] ) - AssertLexemes( + assertLexemes( "0x1p+1️⃣QWERTY", lexemes: [LexemeSpec(.floatingLiteral, text: "0x1p+QWERTY", diagnostic: "'Q' is not a valid digit in floating point exponent")] ) } func testInvalidCharacterSpanningMultipleBytes() { - AssertLexemes( + assertLexemes( "121️⃣😡", lexemes: [ LexemeSpec(.integerLiteral, text: "12😡", diagnostic: "'😡' is not a valid digit in integer literal") @@ -770,30 +770,30 @@ public class LexerTests: XCTestCase { } func testBadNumericLiteralDigits() { - AssertLexemes( + assertLexemes( "01️⃣a1234567", lexemes: [LexemeSpec(.integerLiteral, text: "0a1234567", diagnostic: "'a' is not a valid digit in integer literal")] ) - AssertLexemes( + assertLexemes( "01231️⃣A5678", lexemes: [LexemeSpec(.integerLiteral, text: "0123A5678", diagnostic: "'A' is not a valid digit in integer literal")] ) - AssertLexemes( + assertLexemes( "0b101️⃣20101", lexemes: [LexemeSpec(.integerLiteral, text: "0b1020101", diagnostic: "'2' is not a valid binary digit (0 or 1) in integer literal")] ) - AssertLexemes( + assertLexemes( "0o13571️⃣864", lexemes: [LexemeSpec(.integerLiteral, text: "0o1357864", diagnostic: "'8' is not a valid octal digit (0-7) in integer literal")] ) - AssertLexemes( + assertLexemes( "0x147AD1️⃣G0", lexemes: [LexemeSpec(.integerLiteral, text: "0x147ADG0", diagnostic: "'G' is not a valid hexadecimal digit (0-9, A-F) in integer literal")] ) } func testStringLiteralWithBlockCommentStart() { - AssertLexemes( + assertLexemes( """ "/*" """, @@ -812,7 +812,7 @@ public class LexerTests: XCTestCase { return XCTFail("Expected 1 lexeme, got \(lexemes.count)") } - AssertRawBytesLexeme( + assertRawBytesLexeme( lexemes[0], kind: .eof, leadingTrivia: sourceBytes, @@ -828,7 +828,7 @@ public class LexerTests: XCTestCase { return XCTFail("Expected 2 lexemes, got \(lexemes.count)") } - AssertRawBytesLexeme( + assertRawBytesLexeme( lexemes[0], kind: .identifier, text: sourceBytes @@ -843,7 +843,7 @@ public class LexerTests: XCTestCase { return XCTFail("Expected 4 lexemes, got \(lexemes.count)") } - AssertRawBytesLexeme( + assertRawBytesLexeme( lexemes[1], kind: .binaryOperator, text: [UInt8(ascii: "+")], @@ -859,7 +859,7 @@ public class LexerTests: XCTestCase { guard lexemes.count == 1 else { return XCTFail("Expected 1 lexeme, got \(lexemes.count)") } - AssertRawBytesLexeme( + assertRawBytesLexeme( lexemes[0], kind: .eof, leadingTrivia: sourceBytes, @@ -876,7 +876,7 @@ public class LexerTests: XCTestCase { guard lexemes.count == 1 else { return XCTFail("Expected 1 lexeme, got \(lexemes.count)") } - AssertRawBytesLexeme( + assertRawBytesLexeme( lexemes[0], kind: .eof, leadingTrivia: sourceBytes, @@ -893,7 +893,7 @@ public class LexerTests: XCTestCase { guard lexemes.count == 2 else { return XCTFail("Expected 2 lexemes, got \(lexemes.count)") } - AssertRawBytesLexeme( + assertRawBytesLexeme( lexemes[0], kind: .identifier, leadingTrivia: [0xfd], @@ -904,7 +904,7 @@ public class LexerTests: XCTestCase { } func testInterpolatedString() { - AssertLexemes( + assertLexemes( #""" "\("message")" """#, @@ -924,7 +924,7 @@ public class LexerTests: XCTestCase { } func testBackslashInFrontOfStringInterpolation() { - AssertLexemes( + assertLexemes( #""" "\"\(text)" """#, @@ -942,7 +942,7 @@ public class LexerTests: XCTestCase { } func testUnterminatedSingleLineStringLiteral() { - AssertLexemes( + assertLexemes( ##""" "bar @@ -956,7 +956,7 @@ public class LexerTests: XCTestCase { } func testUnclosedStringInterpolationWithNewline() { - AssertLexemes( + assertLexemes( #""" "\( @@ -973,7 +973,7 @@ public class LexerTests: XCTestCase { } func testNewlineInInterpolationOfSingleLineString() { - AssertLexemes( + assertLexemes( #""" "test \(label: foo)" @@ -994,7 +994,7 @@ public class LexerTests: XCTestCase { } func testMultilineStringLiteral() { - AssertLexemes( + assertLexemes( #""" """ line 1 @@ -1010,7 +1010,7 @@ public class LexerTests: XCTestCase { ] ) - AssertLexemes( + assertLexemes( #""" """ line 1 \ @@ -1028,7 +1028,7 @@ public class LexerTests: XCTestCase { } func testMultiDigitTupleAccess() { - AssertLexemes( + assertLexemes( "x.13.1", lexemes: [ LexemeSpec(.identifier, text: "x"), @@ -1041,7 +1041,7 @@ public class LexerTests: XCTestCase { } func testFloatingPointNumberAfterRangeOperator() { - AssertLexemes( + assertLexemes( "0.1...0.2", lexemes: [ LexemeSpec(.floatingLiteral, text: "0.1"), @@ -1052,7 +1052,7 @@ public class LexerTests: XCTestCase { } func testUnterminatedFloatLiteral() { - AssertLexemes( + assertLexemes( "0.", lexemes: [ LexemeSpec(.integerLiteral, text: "0"), @@ -1062,7 +1062,7 @@ public class LexerTests: XCTestCase { } func testNullCharacterInStringLiteral() { - AssertLexemes( + assertLexemes( """ "1️⃣\0" """, @@ -1080,7 +1080,7 @@ public class LexerTests: XCTestCase { return XCTFail("Expected 4 lexemes") } - AssertRawBytesLexeme( + assertRawBytesLexeme( lexemes[1], kind: .stringSegment, text: [0xef], @@ -1090,7 +1090,7 @@ public class LexerTests: XCTestCase { } func testInvalidUnicodeEscapeSequence() { - AssertLexemes( + assertLexemes( #""" "1️⃣\u" """#, @@ -1101,7 +1101,7 @@ public class LexerTests: XCTestCase { ] ) - AssertLexemes( + assertLexemes( #""" "1️⃣\u{" """#, @@ -1112,7 +1112,7 @@ public class LexerTests: XCTestCase { ] ) - AssertLexemes( + assertLexemes( #""" "1️⃣\u{12" """#, @@ -1123,7 +1123,7 @@ public class LexerTests: XCTestCase { ] ) - AssertLexemes( + assertLexemes( #""" "1️⃣\u{}" """#, @@ -1134,7 +1134,7 @@ public class LexerTests: XCTestCase { ] ) - AssertLexemes( + assertLexemes( #""" "1️⃣\u{hello}" """#, @@ -1145,7 +1145,7 @@ public class LexerTests: XCTestCase { ] ) - AssertLexemes( + assertLexemes( #""" "1️⃣\u{fffffffff}" """#, @@ -1158,7 +1158,7 @@ public class LexerTests: XCTestCase { } func testCloseBlockCommentWithoutOpen() { - AssertLexemes( + assertLexemes( """ 1️⃣*/ """, @@ -1167,7 +1167,7 @@ public class LexerTests: XCTestCase { ] ) - AssertLexemes( + assertLexemes( """ /**/1️⃣*/ """, @@ -1176,7 +1176,7 @@ public class LexerTests: XCTestCase { ] ) - AssertLexemes( + assertLexemes( """ /**/a1️⃣*/ """, @@ -1188,7 +1188,7 @@ public class LexerTests: XCTestCase { } func testCurlyQuotes() { - AssertLexemes( + assertLexemes( """ a 1️⃣“curly string” b """, @@ -1202,14 +1202,14 @@ public class LexerTests: XCTestCase { func testInvalidIdentifierStart() { // Verify that U+0330 (combining tilde below) is a valid identifier continuation - AssertLexemes( + assertLexemes( "a\u{0330}", lexemes: [ LexemeSpec(.identifier, text: "a\u{0330}") ] ) - AssertLexemes( + assertLexemes( "\u{0330}", lexemes: [ LexemeSpec(.identifier, text: "\u{0330}", errorLocationMarker: "START", diagnostic: "an identifier cannot begin with this character") @@ -1218,7 +1218,7 @@ public class LexerTests: XCTestCase { } func testNonBreakingSpace() { - AssertLexemes( + assertLexemes( "a 1️⃣\u{a0} b", lexemes: [ LexemeSpec(.identifier, text: "a", trailing: " \u{a0} ", diagnostic: "non-breaking space (U+00A0) used instead of regular space"), @@ -1228,14 +1228,14 @@ public class LexerTests: XCTestCase { } func testHexLiteralWithoutNumbers() { - AssertLexemes( + assertLexemes( "0x1️⃣", lexemes: [ LexemeSpec(.integerLiteral, text: "0x", diagnostic: "expected hexadecimal digit (0-9, A-F) in integer literal") ] ) - AssertLexemes( + assertLexemes( "0x1️⃣ ", lexemes: [ LexemeSpec(.integerLiteral, text: "0x", trailing: " ", diagnostic: "expected hexadecimal digit (0-9, A-F) in integer literal") @@ -1244,7 +1244,7 @@ public class LexerTests: XCTestCase { } func testUnprintableAsciiCharactersInStringLiteral() { - AssertLexemes( + assertLexemes( """ "1️⃣\u{7}" """, @@ -1259,7 +1259,7 @@ public class LexerTests: XCTestCase { func testLexerErrorOverridesLexerWarning() { // Make sure we output the error about the malformed hex literal instead of // the warning about the non-breaking whitespace. - AssertLexemes( + assertLexemes( "\u{a0}0x1️⃣r", lexemes: [ LexemeSpec(.integerLiteral, leading: "\u{a0}", text: "0xr", diagnostic: "'r' is not a valid hexadecimal digit (0-9, A-F) in integer literal") diff --git a/Tests/SwiftParserTest/Parser+EntryTests.swift b/Tests/SwiftParserTest/Parser+EntryTests.swift index 1f2ff5ec914..0fbceed5a61 100644 --- a/Tests/SwiftParserTest/Parser+EntryTests.swift +++ b/Tests/SwiftParserTest/Parser+EntryTests.swift @@ -16,11 +16,11 @@ import XCTest public class EntryTests: XCTestCase { func testTopLevelStringParse() throws { - AssertParse("func test() {}", { Parser.parse(source: $0) }) + assertParse("func test() {}", { Parser.parse(source: $0) }) } func testTopLevelBufferParse() throws { - AssertParse( + assertParse( "func test() {}", { (source: String) -> SourceFileSyntax in var source = source @@ -31,14 +31,14 @@ public class EntryTests: XCTestCase { } func testSyntaxParse() throws { - AssertParse( + assertParse( "func test() {}", { DeclSyntax.parse(from: &$0) } ) } func testRemainderUnexpected() throws { - AssertParse( + assertParse( "func test() {} 1️⃣other tokens", { DeclSyntax.parse(from: &$0) }, diagnostics: [DiagnosticSpec(message: "unexpected code 'other tokens' in function")] @@ -46,7 +46,7 @@ public class EntryTests: XCTestCase { } func testRemainderUnexpectedDoesntOverrideExistingUnexpected() throws { - AssertParse( + assertParse( "operator 1️⃣test 2️⃣{} other tokens", { DeclSyntax.parse(from: &$0) }, substructure: Syntax( diff --git a/Tests/SwiftParserTest/ParserTests.swift b/Tests/SwiftParserTest/ParserTests.swift index 4f3d447cedc..189e69df57c 100644 --- a/Tests/SwiftParserTest/ParserTests.swift +++ b/Tests/SwiftParserTest/ParserTests.swift @@ -26,7 +26,7 @@ public class ParserTests: XCTestCase { // Debug builds overflow with any stack size bigger than 25-ish. Parser.parse(source: buffer.bindMemory(to: UInt8.self), maximumNestingLevel: 25) }) - AssertDataEqualWithDiff( + assertDataEqualWithDiff( Data(parsed.syntaxTextBytes), fileContents, additionalInfo: "Failed in file \(fileURL)" diff --git a/Tests/SwiftParserTest/StatementTests.swift b/Tests/SwiftParserTest/StatementTests.swift index 1ae14c272c3..454f49c0e21 100644 --- a/Tests/SwiftParserTest/StatementTests.swift +++ b/Tests/SwiftParserTest/StatementTests.swift @@ -16,7 +16,7 @@ import XCTest final class StatementTests: XCTestCase { func testIf() { - AssertParse( + assertParse( """ if let baz {} """, @@ -42,7 +42,7 @@ final class StatementTests: XCTestCase { ) ) - AssertParse( + assertParse( """ if let self = self {} """, @@ -69,9 +69,9 @@ final class StatementTests: XCTestCase { ) ) - AssertParse("if let x { }") + assertParse("if let x { }") - AssertParse( + assertParse( """ if case1️⃣* ! = x { bar() @@ -83,7 +83,7 @@ final class StatementTests: XCTestCase { ] ) - AssertParse( + assertParse( """ if includeSavedHints { a = a.flatMap{ $0 } ?? nil } """ @@ -104,11 +104,11 @@ final class StatementTests: XCTestCase { source += indent + "}\n" } source += "}" - AssertParse(source) + assertParse(source) } func testDo() { - AssertParse( + assertParse( """ do { @@ -118,7 +118,7 @@ final class StatementTests: XCTestCase { } func testDoCatch() { - AssertParse( + assertParse( """ do { @@ -128,7 +128,7 @@ final class StatementTests: XCTestCase { """ ) - AssertParse( + assertParse( """ do {} catch where (error as NSError) == NSError() {} @@ -137,9 +137,9 @@ final class StatementTests: XCTestCase { } func testReturn() { - AssertParse("return actor", { StmtSyntax.parse(from: &$0) }) + assertParse("return actor", { StmtSyntax.parse(from: &$0) }) - AssertParse( + assertParse( "{ 1️⃣return 0 }", { ExprSyntax.parse(from: &$0) }, substructure: Syntax( @@ -151,17 +151,17 @@ final class StatementTests: XCTestCase { substructureAfterMarker: "1️⃣" ) - AssertParse("return") + assertParse("return") - AssertParse( + assertParse( #""" return "assert(\(assertChoices.joined(separator: " || ")))" """# ) - AssertParse("return true ? nil : nil") + assertParse("return true ? nil : nil") - AssertParse( + assertParse( """ switch command { case .start: @@ -178,7 +178,7 @@ final class StatementTests: XCTestCase { } func testSwitch() { - AssertParse( + assertParse( """ switch x { case .A, .B: @@ -187,7 +187,7 @@ final class StatementTests: XCTestCase { """ ) - AssertParse( + assertParse( """ switch 0 { @$dollar case _: @@ -196,7 +196,7 @@ final class StatementTests: XCTestCase { """ ) - AssertParse( + assertParse( """ switch x { case .A: @@ -214,7 +214,7 @@ final class StatementTests: XCTestCase { } func testCStyleForLoop() { - AssertParse( + assertParse( """ 1️⃣for let x = 0; x < 10; x += 1, y += 1 { } @@ -226,21 +226,21 @@ final class StatementTests: XCTestCase { } func testTopLevelCaseRecovery() { - AssertParse( + assertParse( "/*#-editable-code Swift Platground editable area*/1️⃣default/*#-end-editable-code*/", diagnostics: [ DiagnosticSpec(message: "'default' label can only appear inside a 'switch' statement") ] ) - AssertParse( + assertParse( "1️⃣case:", diagnostics: [ DiagnosticSpec(message: "'case' can only appear inside a 'switch' statement or 'enum' declaration") ] ) - AssertParse( + assertParse( #""" 1️⃣case: { ("Hello World") } """#, @@ -251,11 +251,11 @@ final class StatementTests: XCTestCase { } func testMissingIfClauseIntroducer() { - AssertParse("if _ = 42 {}") + assertParse("if _ = 42 {}") } func testAttributesOnStatements() { - AssertParse( + assertParse( """ func test1() { 1️⃣@s return @@ -272,7 +272,7 @@ final class StatementTests: XCTestCase { } func testBogusSwitchStatement() { - AssertParse( + assertParse( """ switch x { 1️⃣foo() @@ -289,7 +289,7 @@ final class StatementTests: XCTestCase { ] ) - AssertParse( + assertParse( """ switch x { 1️⃣print() @@ -310,7 +310,7 @@ final class StatementTests: XCTestCase { } func testBogusLineLabel() { - AssertParse( + assertParse( "LABEL1️⃣:", diagnostics: [ DiagnosticSpec(message: "extraneous code ':' at top level") @@ -319,13 +319,13 @@ final class StatementTests: XCTestCase { } func testIfHasSymbol() { - AssertParse( + assertParse( """ if #_hasSymbol(foo) {} """ ) - AssertParse( + assertParse( """ if #_hasSymbol(foo as () -> ()) {} """ @@ -333,7 +333,7 @@ final class StatementTests: XCTestCase { } func testIdentifierPattern() { - AssertParse( + assertParse( "switch x { case let .y(z): break }", substructure: Syntax( IdentifierPatternSyntax( @@ -344,7 +344,7 @@ final class StatementTests: XCTestCase { } func testCaseContext() { - AssertParse( + assertParse( """ graphQLMap["clientMutationId"] as? 1️⃣Swift.Optional ?? Swift.Optional.none """, @@ -370,7 +370,7 @@ final class StatementTests: XCTestCase { substructureAfterMarker: "1️⃣" ) - AssertParse( + assertParse( """ if case 1️⃣Optional.none = object["anyCol"] { } """, @@ -393,7 +393,7 @@ final class StatementTests: XCTestCase { } func testHangingYieldArgument() { - AssertParse( + assertParse( """ 1️⃣yield print("huh") @@ -405,7 +405,7 @@ final class StatementTests: XCTestCase { func testYield() { // Make sure these are always considered a yield statement - AssertParse( + assertParse( """ var x: Int { _read { @@ -427,7 +427,7 @@ final class StatementTests: XCTestCase { substructureAfterMarker: "1️⃣" ) - AssertParse( + assertParse( """ @inlinable internal subscript(key: Key) -> Value? { @inline(__always) get { @@ -477,7 +477,7 @@ final class StatementTests: XCTestCase { ) // Make sure these are not. - AssertParse( + assertParse( """ var x: Int { _read { @@ -496,7 +496,7 @@ final class StatementTests: XCTestCase { substructureAfterMarker: "1️⃣" ) - AssertParse( + assertParse( """ var x: Int { get { @@ -515,7 +515,7 @@ final class StatementTests: XCTestCase { substructureAfterMarker: "1️⃣" ) - AssertParse( + assertParse( """ yield([]) """, @@ -537,7 +537,7 @@ final class StatementTests: XCTestCase { ) ) - AssertParse( + assertParse( """ func f() -> Int { 1️⃣yield & 5 @@ -555,7 +555,7 @@ final class StatementTests: XCTestCase { substructureAfterMarker: "1️⃣" ) - AssertParse( + assertParse( """ func f() -> Int { 1️⃣yield&5 @@ -575,7 +575,7 @@ final class StatementTests: XCTestCase { } func testForget() { - AssertParse( + assertParse( """ _forget self """, @@ -586,7 +586,7 @@ final class StatementTests: XCTestCase { ) ) - AssertParse( + assertParse( """ _forget Self """, @@ -597,7 +597,7 @@ final class StatementTests: XCTestCase { ) ) - AssertParse( + assertParse( """ _forget SarahMarshall """, @@ -608,7 +608,7 @@ final class StatementTests: XCTestCase { ) ) - AssertParse( + assertParse( """ _forget 1️⃣case """, @@ -619,7 +619,7 @@ final class StatementTests: XCTestCase { ) // It's important that we don't parse this one as a forget statement! - AssertParse( + assertParse( """ func _forget(_ t: T) {} @@ -645,11 +645,11 @@ final class StatementTests: XCTestCase { } func testDefaultIdentIdentifierInReturnStmt() { - AssertParse("return FileManager.default") + assertParse("return FileManager.default") } func testDefaultAsIdentifierInSubscript() { - AssertParse( + assertParse( """ data[position, default: 0] """, @@ -676,7 +676,7 @@ final class StatementTests: XCTestCase { func testSkippingOverEmptyStringLiteral() { // https://github.com/apple/swift-syntax/issues/1247 - AssertParse( + assertParse( """ if p{""1️⃣ """, @@ -687,7 +687,7 @@ final class StatementTests: XCTestCase { } func testRecoveryInFrontOfAccessorIntroducer() { - AssertParse( + assertParse( """ subscript(1️⃣{@2️⃣self _modify3️⃣ """, diff --git a/Tests/SwiftParserTest/TypeCompositionTests.swift b/Tests/SwiftParserTest/TypeCompositionTests.swift index 5a8994b0033..77e69b9db3a 100644 --- a/Tests/SwiftParserTest/TypeCompositionTests.swift +++ b/Tests/SwiftParserTest/TypeCompositionTests.swift @@ -49,7 +49,7 @@ final class TypeCompositionTests: XCTestCase { var parser = Parser(component) let componentSyntax = TypeSyntax.parse(from: &parser) - AssertParse( + assertParse( "\(component) & \(component) & \(component)", TypeSyntax.parse, substructure: Syntax( diff --git a/Tests/SwiftParserTest/TypeMemberTests.swift b/Tests/SwiftParserTest/TypeMemberTests.swift index 2355392e932..e6c464a99e7 100644 --- a/Tests/SwiftParserTest/TypeMemberTests.swift +++ b/Tests/SwiftParserTest/TypeMemberTests.swift @@ -16,7 +16,7 @@ import XCTest final class TypeMemberTests: XCTestCase { func testKeyword() { - AssertParse( + assertParse( "MyType.class", TypeSyntax.parse, substructure: Syntax( @@ -31,7 +31,7 @@ final class TypeMemberTests: XCTestCase { } func testMissing() { - AssertParse( + assertParse( "MyType.1️⃣", TypeSyntax.parse, substructure: Syntax( @@ -66,7 +66,7 @@ final class TypeMemberTests: XCTestCase { #line: "MyType\n.\nNested", ] for (line, source) in cases { - AssertParse( + assertParse( source, TypeSyntax.parse, substructure: expected, @@ -83,7 +83,7 @@ final class TypeMemberTests: XCTestCase { #line: "MyType1️⃣./*bar*/Nested", ] for (line, source) in cases { - AssertParse( + assertParse( source, TypeSyntax.parse, diagnostics: [DiagnosticSpec(message: "extraneous whitespace after '.' is not permitted")], @@ -133,14 +133,14 @@ final class TypeMemberTests: XCTestCase { name: .identifier("Z") ) - AssertParse( + assertParse( "\(baseType).Z", TypeSyntax.parse, substructure: Syntax(expectedSyntax), line: line ) - AssertParse( + assertParse( "\(baseType).Z", TypeSyntax.parse, substructure: Syntax( diff --git a/Tests/SwiftParserTest/TypeMetatypeTests.swift b/Tests/SwiftParserTest/TypeMetatypeTests.swift index 9bc315c8a2e..07b9301fe77 100644 --- a/Tests/SwiftParserTest/TypeMetatypeTests.swift +++ b/Tests/SwiftParserTest/TypeMetatypeTests.swift @@ -53,7 +53,7 @@ final class TypeMetatypeTests: XCTestCase { let baseTypeSyntax = TypeSyntax.parse(from: &parser) for metaKind in [.`Type`, .`Protocol`] as [Keyword] { - AssertParse( + assertParse( "\(baseType).\(metaKind)", TypeSyntax.parse, substructure: Syntax( diff --git a/Tests/SwiftParserTest/TypeTests.swift b/Tests/SwiftParserTest/TypeTests.swift index faf541932b6..a40e771da4a 100644 --- a/Tests/SwiftParserTest/TypeTests.swift +++ b/Tests/SwiftParserTest/TypeTests.swift @@ -17,7 +17,7 @@ import XCTest final class TypeTests: XCTestCase { func testMissingColonInType() { - AssertParse( + assertParse( """ var foo 1️⃣Bar = 1 """, @@ -28,22 +28,22 @@ final class TypeTests: XCTestCase { } func testClosureParsing() { - AssertParse( + assertParse( "(a, b) -> c", { TypeSyntax.parse(from: &$0) } ) - AssertParse( + assertParse( "@MainActor (a, b) async throws -> c", { TypeSyntax.parse(from: &$0) } ) - AssertParse("() -> (\u{feff})") + assertParse("() -> (\u{feff})") } func testGenericTypeWithTrivia() { // N.B. Whitespace is significant here. - AssertParse( + assertParse( """ Foo @@ -54,7 +54,7 @@ final class TypeTests: XCTestCase { } func testFunctionTypes() { - AssertParse( + assertParse( "t as(1️⃣..)->2️⃣", diagnostics: [ DiagnosticSpec(locationMarker: "1️⃣", message: "expected type in function type"), @@ -66,7 +66,7 @@ final class TypeTests: XCTestCase { func testClosureSignatures() { - AssertParse( + assertParse( """ simple { [] str in print("closure with empty capture list") @@ -74,7 +74,7 @@ final class TypeTests: XCTestCase { """ ) - AssertParse( + assertParse( """ { () throws -> Void in } @@ -82,14 +82,14 @@ final class TypeTests: XCTestCase { { ExprSyntax.parse(from: &$0) } ) - AssertParse( + assertParse( """ { [weak a, unowned(safe) self, b = 3] (a: Int, b: Int, _: Int) -> Int in } """, { ExprSyntax.parse(from: &$0) } ) - AssertParse( + assertParse( "{[1️⃣class]in2️⃣", { ExprSyntax.parse(from: &$0) }, diagnostics: [ @@ -99,7 +99,7 @@ final class TypeTests: XCTestCase { ] ) - AssertParse( + assertParse( "{[n1️⃣`]in}", { ExprSyntax.parse(from: &$0) }, diagnostics: [ @@ -107,7 +107,7 @@ final class TypeTests: XCTestCase { ] ) - AssertParse( + assertParse( "{[weak1️⃣^]in}", { ExprSyntax.parse(from: &$0) }, diagnostics: [ @@ -118,7 +118,7 @@ final class TypeTests: XCTestCase { } func testOpaqueReturnTypes() { - AssertParse( + assertParse( """ public typealias Body = @_opaqueReturnTypeOf("$s6CatKit10pspspspspsV5cmereV6lilguyQrvp", 0) __ """ @@ -126,7 +126,7 @@ final class TypeTests: XCTestCase { } func testVariadics() { - AssertParse( + assertParse( #""" func takesVariadicFnWithGenericRet(_ fn: (S...) -> T) {} let _: (S...) -> Int = \.i @@ -137,7 +137,7 @@ final class TypeTests: XCTestCase { } func testConvention() { - AssertParse( + assertParse( #""" let _: @convention(thin) (@convention(thick) () -> (), @convention(thin) () -> (), @@ -152,7 +152,7 @@ final class TypeTests: XCTestCase { } func testNamedOpaqueReturnTypes() { - AssertParse( + assertParse( """ func f2() -> Int { } diff --git a/Tests/SwiftParserTest/VariadicGenericsTests.swift b/Tests/SwiftParserTest/VariadicGenericsTests.swift index 97828b07fb0..a540b2a09ba 100644 --- a/Tests/SwiftParserTest/VariadicGenericsTests.swift +++ b/Tests/SwiftParserTest/VariadicGenericsTests.swift @@ -15,7 +15,7 @@ import XCTest final class VariadicGenericsTests: XCTestCase { func testSimpleForwarding() { - AssertParse( + assertParse( """ func tuplify(_ t: repeat each T) -> (repeat each T) { return (1️⃣repeat each t) @@ -37,7 +37,7 @@ final class VariadicGenericsTests: XCTestCase { } func testRequirement() { - AssertParse( + assertParse( """ func requirement() where each T: P { } @@ -47,7 +47,7 @@ final class VariadicGenericsTests: XCTestCase { func testElementOutsideExpansion() { // This is valid to parse, and becomes invalid during type resolution. - AssertParse( + assertParse( """ func invalid(_ t: each T) -> each T {} """ @@ -55,7 +55,7 @@ final class VariadicGenericsTests: XCTestCase { } func testInvalidPackElement() { - AssertParse( + assertParse( """ func invalid() -> (each any 1️⃣T) {} """, @@ -64,7 +64,7 @@ final class VariadicGenericsTests: XCTestCase { ] ) - AssertParse( + assertParse( """ func invalid(_: each T 1️⃣& P) {} """, @@ -75,7 +75,7 @@ final class VariadicGenericsTests: XCTestCase { } func testTypeParameterPackEllipsis() { - AssertParse( + assertParse( """ func invalid(_ t: repeat each T) {} """, @@ -92,7 +92,7 @@ final class VariadicGenericsTests: XCTestCase { } func testTypeParameterPackEachEllipsis() { - AssertParse( + assertParse( """ func invalid(_ t: repeat each T) {} """, @@ -106,7 +106,7 @@ final class VariadicGenericsTests: XCTestCase { } func testPackElementExprSimple() { - AssertParse( + assertParse( """ func tuplify(_ t: repeat each T) -> (repeat each T) { return (repeat each t) @@ -114,7 +114,7 @@ final class VariadicGenericsTests: XCTestCase { """ ) - AssertParse( + assertParse( """ func zip(_ first: repeat each T, with second: repeat each U) -> (repeat (each T, each U)) { return (repeat (each first, each second)) @@ -122,7 +122,7 @@ final class VariadicGenericsTests: XCTestCase { """ ) - AssertParse( + assertParse( """ func variadicMap(_ t: repeat each T, transform: repeat (each T) -> each Result) -> (repeat each Result) { return (repeat (each transform)(each t)) @@ -148,7 +148,7 @@ final class VariadicGenericsTests: XCTestCase { rightParen: .rightParenToken() ) - AssertParse( + assertParse( """ func test() { 1️⃣each(x) @@ -158,7 +158,7 @@ final class VariadicGenericsTests: XCTestCase { substructureAfterMarker: "1️⃣" ) - AssertParse( + assertParse( """ func test() { 1️⃣each (x) @@ -168,7 +168,7 @@ final class VariadicGenericsTests: XCTestCase { substructureAfterMarker: "1️⃣" ) - AssertParse( + assertParse( """ func test() { 1️⃣each x @@ -187,7 +187,7 @@ final class VariadicGenericsTests: XCTestCase { } func testPackExpansionExpr() { - AssertParse( + assertParse( """ func expand(_ t: repeat each T) { 1️⃣repeat (each t).member() @@ -220,7 +220,7 @@ final class VariadicGenericsTests: XCTestCase { substructureAfterMarker: "1️⃣" ) - AssertParse( + assertParse( """ func expand(_ t: repeat each T) { 1️⃣repeat each t.member @@ -245,7 +245,7 @@ final class VariadicGenericsTests: XCTestCase { substructureAfterMarker: "1️⃣" ) - AssertParse( + assertParse( """ func expand(_ t: repeat each T) { 1️⃣repeat x + each t + 10 @@ -293,7 +293,7 @@ final class VariadicGenericsTests: XCTestCase { } func testMetatype() { - AssertParse( + assertParse( """ G>.self """ @@ -303,28 +303,28 @@ final class VariadicGenericsTests: XCTestCase { final class TypeParameterPackTests: XCTestCase { func testParameterPacks1() { - AssertParse( + assertParse( """ func f1() -> repeat each T {} """ ) } func testParameterPacks2() { - AssertParse( + assertParse( """ func f2() -> (repeat each T) {} """ ) } func testParameterPacks3() { - AssertParse( + assertParse( """ func f3() -> G {} """ ) } func testParameterPacks4() { - AssertParse( + assertParse( """ protocol P { associatedtype 1️⃣each T @@ -339,7 +339,7 @@ final class TypeParameterPackTests: XCTestCase { ) } func testParameterPacks4EarlySyntax() { - AssertParse( + assertParse( """ protocol P { associatedtype T1️⃣... @@ -354,119 +354,119 @@ final class TypeParameterPackTests: XCTestCase { ) } func testParameterPacks5() { - AssertParse( + assertParse( """ typealias Alias = (repeat each T) """ ) } func testParameterPacks6() { - AssertParse( + assertParse( """ struct S {} """ ) } func testParameterPacks7() { - AssertParse( + assertParse( """ struct S {} """ ) } func testParameterPacks8() { - AssertParse( + assertParse( """ struct S {} """ ) } func testParameterPacks9() { - AssertParse( + assertParse( """ struct S {} """ ) } func testParameterPacks10() { - AssertParse( + assertParse( """ struct S {} """ ) } func testParameterPacks11() { - AssertParse( + assertParse( """ struct S {} """ ) } func testParameterPacks12() { - AssertParse( + assertParse( """ struct S {} """ ) } func testParameterPacks13() { - AssertParse( + assertParse( """ func foo(_ x: repeat each T) {} """ ) } func testParameterPacks14() { - AssertParse( + assertParse( """ func foo(_ x: repeat each T) {} """ ) } func testParameterPacks15() { - AssertParse( + assertParse( """ func foo(_ x: repeat each T) {} """ ) } func testParameterPacks16() { - AssertParse( + assertParse( """ func foo(_ x: repeat each T) {} """ ) } func testParameterPacks17() { - AssertParse( + assertParse( """ func foo(_ x: repeat each T) {} """ ) } func testParameterPacks18() { - AssertParse( + assertParse( """ func foo(x: T, y: U, z: repeat each V) { } """ ) } func testParameterPacks19() { - AssertParse( + assertParse( """ func foo(x: T, y: repeat each U, z: V) { } """ ) } func testParameterPacks20() { - AssertParse( + assertParse( """ func foo(x: repeat each T, y: repeat each U, z: repeat each V) { } """ ) } func testParameterPacks21() { - AssertParse( + assertParse( """ enum E { case f1(_: repeat each T) @@ -475,7 +475,7 @@ final class TypeParameterPackTests: XCTestCase { ) } func testParameterPacks22() { - AssertParse( + assertParse( """ enum E { case f2(_: G) @@ -484,7 +484,7 @@ final class TypeParameterPackTests: XCTestCase { ) } func testParameterPacks23() { - AssertParse( + assertParse( """ enum E { var x: repeat each T { fatalError() } @@ -493,7 +493,7 @@ final class TypeParameterPackTests: XCTestCase { ) } func testParameterPacks24() { - AssertParse( + assertParse( """ enum E { var x: (repeat each T) { fatalError() } @@ -502,7 +502,7 @@ final class TypeParameterPackTests: XCTestCase { ) } func testParameterPacks25() { - AssertParse( + assertParse( """ enum E { subscript(_: repeat each T) -> Int { fatalError() } @@ -511,7 +511,7 @@ final class TypeParameterPackTests: XCTestCase { ) } func testParameterPacks26() { - AssertParse( + assertParse( """ enum E { subscript() -> repeat each T { fatalError() } @@ -520,7 +520,7 @@ final class TypeParameterPackTests: XCTestCase { ) } func testParameterPacks27() { - AssertParse( + assertParse( """ enum E { subscript() -> (repeat each T) { fatalError() } @@ -530,7 +530,7 @@ final class TypeParameterPackTests: XCTestCase { } func testVariadicTypes() { - AssertParse( + assertParse( """ let _: G< > = G() let _: G = G() @@ -544,19 +544,19 @@ final class TypeParameterPackTests: XCTestCase { } func testMissingCommaInType() throws { - AssertParse( + assertParse( """ var foo: (Int) """ ) - AssertParse( + assertParse( """ var foo: (Int, Int) """ ) - AssertParse( + assertParse( """ var foo: (bar: Int 1️⃣bar2: Int) """, @@ -565,7 +565,7 @@ final class TypeParameterPackTests: XCTestCase { ] ) - AssertParse( + assertParse( """ var foo: (bar: Int 1️⃣Int) """, @@ -574,7 +574,7 @@ final class TypeParameterPackTests: XCTestCase { ] ) - AssertParse( + assertParse( """ var foo: (a 1️⃣Int) """, @@ -583,7 +583,7 @@ final class TypeParameterPackTests: XCTestCase { ] ) - AssertParse( + assertParse( """ var foo: (A 1️⃣Int) """, @@ -592,7 +592,7 @@ final class TypeParameterPackTests: XCTestCase { ] ) - AssertParse( + assertParse( """ var foo: (_ 1️⃣a 2️⃣Int) """, @@ -602,7 +602,7 @@ final class TypeParameterPackTests: XCTestCase { ] ) - AssertParse( + assertParse( """ var foo: (Array 1️⃣Array) """, @@ -611,7 +611,7 @@ final class TypeParameterPackTests: XCTestCase { ] ) - AssertParse( + assertParse( """ var foo: (a 1️⃣Array) """, @@ -620,7 +620,7 @@ final class TypeParameterPackTests: XCTestCase { ] ) - AssertParse( + assertParse( """ var foo: (Array 1️⃣a) """, diff --git a/Tests/SwiftParserTest/translated/ActorTests.swift b/Tests/SwiftParserTest/translated/ActorTests.swift index 71f4b50847e..b68937a6aa0 100644 --- a/Tests/SwiftParserTest/translated/ActorTests.swift +++ b/Tests/SwiftParserTest/translated/ActorTests.swift @@ -16,7 +16,7 @@ import XCTest final class ActorTests: XCTestCase { func testActor1() { - AssertParse( + assertParse( """ actor MyActor11️⃣ """, @@ -27,7 +27,7 @@ final class ActorTests: XCTestCase { } func testActor2() { - AssertParse( + assertParse( """ actor MyActor2 ℹ️{ init() { diff --git a/Tests/SwiftParserTest/translated/AlwaysEmitConformanceMetadataAttrTests.swift b/Tests/SwiftParserTest/translated/AlwaysEmitConformanceMetadataAttrTests.swift index e60ec1d312e..a8c11b77737 100644 --- a/Tests/SwiftParserTest/translated/AlwaysEmitConformanceMetadataAttrTests.swift +++ b/Tests/SwiftParserTest/translated/AlwaysEmitConformanceMetadataAttrTests.swift @@ -16,7 +16,7 @@ import XCTest final class AlwaysEmitConformanceMetadataAttrTests: XCTestCase { func testAlwaysEmitConformanceMetadataAttr() { - AssertParse( + assertParse( """ @_alwaysEmitConformanceMetadata protocol Test {} diff --git a/Tests/SwiftParserTest/translated/AsyncSyntaxTests.swift b/Tests/SwiftParserTest/translated/AsyncSyntaxTests.swift index 057d57d2c03..ab51eb28eb5 100644 --- a/Tests/SwiftParserTest/translated/AsyncSyntaxTests.swift +++ b/Tests/SwiftParserTest/translated/AsyncSyntaxTests.swift @@ -16,7 +16,7 @@ import XCTest final class AsyncSyntaxTests: XCTestCase { func testAsyncSyntax1() { - AssertParse( + assertParse( """ func asyncGlobal1() async { } func asyncGlobal2() async throws { } @@ -25,7 +25,7 @@ final class AsyncSyntaxTests: XCTestCase { } func testAsyncSyntax2() { - AssertParse( + assertParse( """ typealias AsyncFunc1 = () async -> () typealias AsyncFunc2 = () async throws -> () @@ -35,7 +35,7 @@ final class AsyncSyntaxTests: XCTestCase { } func testAsyncSyntax3() { - AssertParse( + assertParse( """ func testTypeExprs() { let _ = [() async -> ()]() @@ -46,7 +46,7 @@ final class AsyncSyntaxTests: XCTestCase { } func testAsyncSyntax4() { - AssertParse( + assertParse( """ func testAwaitOperator() async { let _ = await asyncGlobal1() @@ -56,7 +56,7 @@ final class AsyncSyntaxTests: XCTestCase { } func testAsyncSyntax5() { - AssertParse( + assertParse( """ func testAsyncClosure() { let _ = { () async in 5 } @@ -68,7 +68,7 @@ final class AsyncSyntaxTests: XCTestCase { } func testAsyncSyntax6() { - AssertParse( + assertParse( """ func testAwait() async { let _ = await asyncGlobal1() diff --git a/Tests/SwiftParserTest/translated/AsyncTests.swift b/Tests/SwiftParserTest/translated/AsyncTests.swift index 06b90ae8b54..b71b9cf6ac7 100644 --- a/Tests/SwiftParserTest/translated/AsyncTests.swift +++ b/Tests/SwiftParserTest/translated/AsyncTests.swift @@ -16,7 +16,7 @@ import XCTest final class AsyncTests: XCTestCase { func testAsync1() { - AssertParse( + assertParse( """ // Parsing function declarations with 'async' func asyncGlobal1() async { } @@ -26,7 +26,7 @@ final class AsyncTests: XCTestCase { } func testAsync2() { - AssertParse( + assertParse( "func asyncGlobal3() throws 1️⃣async { }", diagnostics: [ DiagnosticSpec(message: "'async' must precede 'throws'", fixIts: ["move 'async' in front of 'throws'"]) @@ -36,7 +36,7 @@ final class AsyncTests: XCTestCase { } func testAsync3() { - AssertParse( + assertParse( "func asyncGlobal3(fn: () throws -> Int) rethrows 1️⃣async { }", diagnostics: [ DiagnosticSpec(message: "'async' must precede 'rethrows'", fixIts: ["move 'async' in front of 'rethrows'"]) @@ -46,7 +46,7 @@ final class AsyncTests: XCTestCase { } func testAsync4() { - AssertParse( + assertParse( "func asyncGlobal4() -> Int 1️⃣async { }", diagnostics: [ DiagnosticSpec(message: "'async' must preceed '->'", fixIts: ["move 'async' in front of '->'"]) @@ -56,7 +56,7 @@ final class AsyncTests: XCTestCase { } func testAsync5() { - AssertParse( + assertParse( "func asyncGlobal5() -> Int 1️⃣async throws { }", diagnostics: [ DiagnosticSpec(message: "'async throws' must preceed '->'") @@ -66,7 +66,7 @@ final class AsyncTests: XCTestCase { } func testAsync6() { - AssertParse( + assertParse( "func asyncGlobal6() -> Int 1️⃣throws async { }", diagnostics: [ DiagnosticSpec(message: "'throws async' must preceed '->'", fixIts: ["move 'throws async' in front of '->'"]) @@ -76,7 +76,7 @@ final class AsyncTests: XCTestCase { } func testAsync7() { - AssertParse( + assertParse( "func asyncGlobal7() throws -> Int 1️⃣async { }", diagnostics: [ DiagnosticSpec(message: "'async' must preceed '->'") @@ -86,7 +86,7 @@ final class AsyncTests: XCTestCase { } func testAsync8() { - AssertParse( + assertParse( """ func asyncGlobal8() async throws 1️⃣async -> 2️⃣async Int 3️⃣async {} """, @@ -102,7 +102,7 @@ final class AsyncTests: XCTestCase { } func testAsync9() { - AssertParse( + assertParse( """ class X { init() async { } @@ -125,7 +125,7 @@ final class AsyncTests: XCTestCase { } func testAsync10a() { - AssertParse( + assertParse( """ typealias AsyncFunc1 = () async -> () """ @@ -133,7 +133,7 @@ final class AsyncTests: XCTestCase { } func testAsync10b() { - AssertParse( + assertParse( """ typealias AsyncFunc2 = () async throws -> () """ @@ -141,7 +141,7 @@ final class AsyncTests: XCTestCase { } func testAsync10c() { - AssertParse( + assertParse( "typealias AsyncFunc3 = () throws 1️⃣async -> ()", diagnostics: [ DiagnosticSpec(message: "'async' must precede 'throws'") @@ -151,7 +151,7 @@ final class AsyncTests: XCTestCase { } func testAsync11a() { - AssertParse( + assertParse( """ let _ = [() async -> ()]() """ @@ -159,7 +159,7 @@ final class AsyncTests: XCTestCase { } func testAsync11b() { - AssertParse( + assertParse( """ let _ = [() async throws -> ()]() """ @@ -167,7 +167,7 @@ final class AsyncTests: XCTestCase { } func testAsync11c() { - AssertParse( + assertParse( "let _ = [() throws 1️⃣async -> ()]()", diagnostics: [ DiagnosticSpec(message: "'async' must precede 'throws'") @@ -177,7 +177,7 @@ final class AsyncTests: XCTestCase { } func testAsync11d() { - AssertParse( + assertParse( """ let _ = [() -> 1️⃣async ()]() """, @@ -188,7 +188,7 @@ final class AsyncTests: XCTestCase { } func testAsync12() { - AssertParse( + assertParse( """ // Parsing await syntax. struct MyFuture { @@ -199,7 +199,7 @@ final class AsyncTests: XCTestCase { } func testAsync13() { - AssertParse( + assertParse( """ func testAwaitExpr() async { let _ = await asyncGlobal1() @@ -211,7 +211,7 @@ final class AsyncTests: XCTestCase { } func testAsync14() { - AssertParse( + assertParse( """ func getIntSomeday() async -> Int { 5 } """ @@ -219,7 +219,7 @@ final class AsyncTests: XCTestCase { } func testAsync15() { - AssertParse( + assertParse( """ func testAsyncLet() async { async let x = await getIntSomeday() @@ -230,7 +230,7 @@ final class AsyncTests: XCTestCase { } func testAsync16() { - AssertParse( + assertParse( """ async func asyncIncorrectly() { } """ diff --git a/Tests/SwiftParserTest/translated/AvailabilityQueryTests.swift b/Tests/SwiftParserTest/translated/AvailabilityQueryTests.swift index b7fc3aae8e2..f5e84512990 100644 --- a/Tests/SwiftParserTest/translated/AvailabilityQueryTests.swift +++ b/Tests/SwiftParserTest/translated/AvailabilityQueryTests.swift @@ -16,7 +16,7 @@ import XCTest final class AvailabilityQueryTests: XCTestCase { func testAvailabilityQuery1() { - AssertParse( + assertParse( """ if #available(OSX 10.51, *) { } @@ -25,7 +25,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery2() { - AssertParse( + assertParse( """ // Disallow use as an expression. if (1️⃣#available(OSX 10.51, *)) {} @@ -37,7 +37,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery3() { - AssertParse( + assertParse( """ let x = 1️⃣#available(OSX 10.51, *) """, @@ -48,7 +48,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery4() { - AssertParse( + assertParse( """ (1️⃣#available(OSX 10.51, *) ? 1 : 0) """, @@ -59,7 +59,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery5a() { - AssertParse( + assertParse( """ if !1️⃣#available(OSX 10.52, *) { } @@ -75,7 +75,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery5b() { - AssertParse( + assertParse( """ if let _ = Optional(5), !1️⃣#available(OSX 10.52, *) { } @@ -87,7 +87,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery6() { - AssertParse( + assertParse( """ if #available(OSX 10.51, *) 1️⃣&& #available(OSX 10.52, *) { } @@ -103,7 +103,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery7() { - AssertParse( + assertParse( """ if #available 1️⃣{ } @@ -115,7 +115,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery8() { - AssertParse( + assertParse( """ if #available( 1️⃣{ } @@ -128,7 +128,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery9() { - AssertParse( + assertParse( """ if #available(1️⃣) { } @@ -140,7 +140,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery10() { - AssertParse( + assertParse( """ if #availableℹ️(OSX 1️⃣{ } @@ -157,7 +157,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery11() { - AssertParse( + assertParse( """ if #available(OSX) { } @@ -166,7 +166,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery12() { - AssertParse( + assertParse( """ if #availableℹ️(OSX 10.51 1️⃣{ } @@ -183,7 +183,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery13() { - AssertParse( + assertParse( """ if #available(iDishwasherOS 10.51) { } @@ -192,7 +192,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery14() { - AssertParse( + assertParse( """ if #available(iDishwasherOS 10.51, *) { } @@ -201,7 +201,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery15() { - AssertParse( + assertParse( """ if #available(macos 10.51, *) { } @@ -210,7 +210,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery16() { - AssertParse( + assertParse( """ if #available(mscos 10.51, *) { } @@ -219,7 +219,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery17() { - AssertParse( + assertParse( """ if #available(macoss 10.51, *) { } @@ -228,7 +228,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery18() { - AssertParse( + assertParse( """ if #available(mac 10.51, *) { } @@ -237,7 +237,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery19() { - AssertParse( + assertParse( """ if #available(OSX 10.51, OSX 10.52, *) { } @@ -246,7 +246,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery20() { - AssertParse( + assertParse( """ if #available(OSX 10.52) { } """ @@ -254,7 +254,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery21() { - AssertParse( + assertParse( """ if #available(OSX 10.51, iOS 8.0) { } """ @@ -262,7 +262,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery22() { - AssertParse( + assertParse( """ if #available(iOS 8.0, *) { } @@ -271,7 +271,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery23() { - AssertParse( + assertParse( """ if #available(iOSApplicationExtension, unavailable) { // expected-error 2{{expected version number}} } @@ -280,7 +280,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery24() { - AssertParse( + assertParse( """ // Want to make sure we can parse this. Perhaps we should not let this validate, though. if #available(*) { @@ -290,7 +290,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery25() { - AssertParse( + assertParse( """ if #availableℹ️(* 1️⃣{ } @@ -307,7 +307,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery26() { - AssertParse( + assertParse( """ // Multiple platforms if #available(OSX 10.51, iOS 8.0, *) { @@ -317,7 +317,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery27() { - AssertParse( + assertParse( """ if #available(OSX 10.51, 1️⃣{ } @@ -330,7 +330,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery28() { - AssertParse( + assertParse( """ if #available(OSX 10.51,1️⃣) { } @@ -342,7 +342,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery29() { - AssertParse( + assertParse( """ if #availableℹ️(OSX 10.51, iOS 1️⃣{ } @@ -359,7 +359,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery30() { - AssertParse( + assertParse( """ if #available(OSX 10.51, iOS 8.0, iDishwasherOS 10.51) { } @@ -368,7 +368,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery31() { - AssertParse( + assertParse( """ if #available(iDishwasherOS 10.51, OSX 10.51) { } @@ -377,7 +377,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery32() { - AssertParse( + assertParse( """ if #available(OSX 10.51 1️⃣|| iOS 8.0) { } @@ -393,7 +393,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery33() { - AssertParse( + assertParse( """ // Emit Fix-It removing un-needed >=, for the moment. """ @@ -401,7 +401,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery34() { - AssertParse( + assertParse( """ if #available(OSX 1️⃣>= 10.51, *) { } @@ -417,7 +417,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery35() { - AssertParse( + assertParse( """ // Bool then #available. if 1 != 2, #available(iOS 8.0, *) {} @@ -426,7 +426,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery36() { - AssertParse( + assertParse( """ // Pattern then #available(iOS 8.0, *) { if case 42 = 42, #available(iOS 8.0, *) {} @@ -436,7 +436,7 @@ final class AvailabilityQueryTests: XCTestCase { } func testAvailabilityQuery37() { - AssertParse( + assertParse( #""" // Allow "macOS" as well. if #available(macOS 10.51, *) { diff --git a/Tests/SwiftParserTest/translated/AvailabilityQueryUnavailabilityTests.swift b/Tests/SwiftParserTest/translated/AvailabilityQueryUnavailabilityTests.swift index 00421bd65fb..fc9aca876e1 100644 --- a/Tests/SwiftParserTest/translated/AvailabilityQueryUnavailabilityTests.swift +++ b/Tests/SwiftParserTest/translated/AvailabilityQueryUnavailabilityTests.swift @@ -16,7 +16,7 @@ import XCTest final class AvailabilityQueryUnavailabilityTests: XCTestCase { func testAvailabilityQueryUnavailability1() { - AssertParse( + assertParse( """ // This file is mostly an inverted version of availability_query.swift if #unavailable(OSX 10.51) { @@ -26,7 +26,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability2a() { - AssertParse( + assertParse( """ // Disallow explicit wildcards. if #unavailable(OSX 10.51, *) {} @@ -44,7 +44,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability2b() { - AssertParse( + assertParse( """ if !1️⃣#unavailable(OSX 10.52) { } @@ -60,7 +60,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability2c() { - AssertParse( + assertParse( """ if let _ = Optional(5), !1️⃣#unavailable(OSX 10.52) { } @@ -72,7 +72,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability3() { - AssertParse( + assertParse( """ if #unavailable(OSX 10.51) 1️⃣&& #unavailable(OSX 10.52) { } @@ -84,7 +84,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability4() { - AssertParse( + assertParse( """ if #unavailable 1️⃣{ } @@ -96,7 +96,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability5() { - AssertParse( + assertParse( """ if #unavailable( 1️⃣{ } @@ -109,7 +109,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability6() { - AssertParse( + assertParse( """ if #unavailable(1️⃣) { } @@ -121,7 +121,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability7() { - AssertParse( + assertParse( """ if #unavailableℹ️(OSX 1️⃣{ } @@ -138,7 +138,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability8() { - AssertParse( + assertParse( """ if #unavailable(OSX) { } @@ -147,7 +147,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability9() { - AssertParse( + assertParse( """ if #unavailableℹ️(OSX 10.51 1️⃣{ } @@ -164,7 +164,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability10() { - AssertParse( + assertParse( """ if #unavailable(iDishwasherOS 10.51) { } @@ -173,7 +173,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability11() { - AssertParse( + assertParse( """ if #unavailable(iDishwasherOS 10.51) { } @@ -182,7 +182,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability12() { - AssertParse( + assertParse( """ if #unavailable(macos 10.51) { } @@ -191,7 +191,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability13() { - AssertParse( + assertParse( """ if #unavailable(mscos 10.51) { } @@ -200,7 +200,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability14() { - AssertParse( + assertParse( """ if #unavailable(macoss 10.51) { } @@ -209,7 +209,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability15() { - AssertParse( + assertParse( """ if #unavailable(mac 10.51) { } @@ -218,7 +218,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability16() { - AssertParse( + assertParse( """ if #unavailable(OSX 10.51, OSX 10.52) { } @@ -227,7 +227,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability17() { - AssertParse( + assertParse( """ if #unavailable(OSX 10.51, iOS 8.0, *) { } if #unavailable(iOS 8.0) { @@ -237,7 +237,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability18() { - AssertParse( + assertParse( """ if #unavailable(iOSApplicationExtension, unavailable) { // expected-error 2{{expected version number}} } @@ -246,7 +246,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability19() { - AssertParse( + assertParse( """ // Should this be a valid spelling since `#unvailable(*)` cannot be written? if #unavailable(1️⃣) { @@ -259,7 +259,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability20() { - AssertParse( + assertParse( """ if #unavailableℹ️(OSX 10 1️⃣{ } @@ -276,7 +276,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability21() { - AssertParse( + assertParse( """ // Multiple platforms if #unavailable(OSX 10.51, iOS 8.0) { @@ -286,7 +286,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability22() { - AssertParse( + assertParse( """ if #unavailable(OSX 10.51, 1️⃣{ } @@ -299,7 +299,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability23() { - AssertParse( + assertParse( """ if #unavailable(OSX 10.51,1️⃣) { } @@ -311,7 +311,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability24() { - AssertParse( + assertParse( """ if #unavailableℹ️(OSX 10.51, iOS 1️⃣{ } @@ -328,7 +328,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability25() { - AssertParse( + assertParse( """ if #unavailable(OSX 10.51, iOS 8.0, iDishwasherOS 10.51) { } @@ -337,7 +337,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability26() { - AssertParse( + assertParse( """ if #unavailable(iDishwasherOS 10.51, OSX 10.51) { } @@ -346,7 +346,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability27() { - AssertParse( + assertParse( """ if #unavailable(OSX 10.51 1️⃣|| iOS 8.0) { } @@ -358,7 +358,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability28() { - AssertParse( + assertParse( """ // Emit Fix-It removing un-needed >=, for the moment. if #unavailable(OSX 1️⃣>= 10.51) { @@ -371,7 +371,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability29() { - AssertParse( + assertParse( """ // Bool then #unavailable. if 1 != 2, #unavailable(iOS 8.0) {} @@ -380,7 +380,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability30() { - AssertParse( + assertParse( """ // Pattern then #unavailable(iOS 8.0) { if case 42 = 42, #unavailable(iOS 8.0) {} @@ -390,7 +390,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability31() { - AssertParse( + assertParse( #""" // Allow "macOS" as well. if #unavailable(macOS 10.51) { @@ -400,7 +400,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability32() { - AssertParse( + assertParse( """ // Prevent availability and unavailability being present in the same statement. if #unavailable(macOS 10.51), #available(macOS 10.52, *) { @@ -420,7 +420,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability33() { - AssertParse( + assertParse( """ // Allow availability and unavailability to mix if they are not in the same statement. if #unavailable(macOS 11) { @@ -434,7 +434,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability34a() { - AssertParse( + assertParse( """ // Diagnose wrong spellings of unavailability if #available(*) 1️⃣== false { @@ -448,7 +448,7 @@ final class AvailabilityQueryUnavailabilityTests: XCTestCase { } func testAvailabilityQueryUnavailability34b() { - AssertParse( + assertParse( """ if !1️⃣#available(*) { } diff --git a/Tests/SwiftParserTest/translated/BorrowExprTests.swift b/Tests/SwiftParserTest/translated/BorrowExprTests.swift index 481d862ba84..4b3b207844a 100644 --- a/Tests/SwiftParserTest/translated/BorrowExprTests.swift +++ b/Tests/SwiftParserTest/translated/BorrowExprTests.swift @@ -16,7 +16,7 @@ import XCTest final class BorrowExprTests: XCTestCase { func testBorrowExpr1() { - AssertParse( + assertParse( """ func useString(_ str: String) {} var global: String = "123" @@ -28,7 +28,7 @@ final class BorrowExprTests: XCTestCase { } func testBorrowExpr2() { - AssertParse( + assertParse( """ func useString(_ str: String) {} func testVar() { diff --git a/Tests/SwiftParserTest/translated/BraceRecoveryEofTests.swift b/Tests/SwiftParserTest/translated/BraceRecoveryEofTests.swift index c70be8bdfb5..2726156e900 100644 --- a/Tests/SwiftParserTest/translated/BraceRecoveryEofTests.swift +++ b/Tests/SwiftParserTest/translated/BraceRecoveryEofTests.swift @@ -16,7 +16,7 @@ import XCTest final class BraceRecoveryEofTests: XCTestCase { func testBraceRecoveryEof1() { - AssertParse( + assertParse( """ // Make sure source ranges satisfy the verifier. for foo in [1, 2] ℹ️{ diff --git a/Tests/SwiftParserTest/translated/BuiltinBridgeObjectTests.swift b/Tests/SwiftParserTest/translated/BuiltinBridgeObjectTests.swift index f8b40716edf..542655719d0 100644 --- a/Tests/SwiftParserTest/translated/BuiltinBridgeObjectTests.swift +++ b/Tests/SwiftParserTest/translated/BuiltinBridgeObjectTests.swift @@ -16,7 +16,7 @@ import XCTest final class BuiltinBridgeObjectTests: XCTestCase { func testBuiltinBridgeObject1() { - AssertParse( + assertParse( """ precedencegroup AssignmentPrecedence { assignment: true } """ @@ -24,7 +24,7 @@ final class BuiltinBridgeObjectTests: XCTestCase { } func testBuiltinBridgeObject2() { - AssertParse( + assertParse( """ var word: Builtin.Word """ @@ -32,7 +32,7 @@ final class BuiltinBridgeObjectTests: XCTestCase { } func testBuiltinBridgeObject3() { - AssertParse( + assertParse( """ class C {} """ @@ -40,7 +40,7 @@ final class BuiltinBridgeObjectTests: XCTestCase { } func testBuiltinBridgeObject4() { - AssertParse( + assertParse( """ var c: C let bo = Builtin.castToBridgeObject(c, word) diff --git a/Tests/SwiftParserTest/translated/BuiltinWordTests.swift b/Tests/SwiftParserTest/translated/BuiltinWordTests.swift index 1a72d23fdb6..bd48116e107 100644 --- a/Tests/SwiftParserTest/translated/BuiltinWordTests.swift +++ b/Tests/SwiftParserTest/translated/BuiltinWordTests.swift @@ -16,7 +16,7 @@ import XCTest final class BuiltinWordTests: XCTestCase { func testBuiltinWord1() { - AssertParse( + assertParse( """ precedencegroup AssignmentPrecedence { assignment: true } """ @@ -24,7 +24,7 @@ final class BuiltinWordTests: XCTestCase { } func testBuiltinWord2() { - AssertParse( + assertParse( """ var word: Builtin.Word var i16: Builtin.Int16 @@ -36,7 +36,7 @@ final class BuiltinWordTests: XCTestCase { } func testBuiltinWord3() { - AssertParse( + assertParse( """ // Check that trunc/?ext operations are appropriately available given the // abstract range of potential Word sizes. @@ -45,7 +45,7 @@ final class BuiltinWordTests: XCTestCase { } func testBuiltinWord4() { - AssertParse( + assertParse( """ word = Builtin.truncOrBitCast_Int128_Word(i128) word = Builtin.truncOrBitCast_Int64_Word(i64) @@ -56,7 +56,7 @@ final class BuiltinWordTests: XCTestCase { } func testBuiltinWord5() { - AssertParse( + assertParse( """ i16 = Builtin.truncOrBitCast_Word_Int16(word) i32 = Builtin.truncOrBitCast_Word_Int32(word) @@ -67,7 +67,7 @@ final class BuiltinWordTests: XCTestCase { } func testBuiltinWord6() { - AssertParse( + assertParse( """ word = Builtin.zextOrBitCast_Int128_Word(i128) word = Builtin.zextOrBitCast_Int64_Word(i64) @@ -78,7 +78,7 @@ final class BuiltinWordTests: XCTestCase { } func testBuiltinWord7() { - AssertParse( + assertParse( """ i16 = Builtin.zextOrBitCast_Word_Int16(word) i32 = Builtin.zextOrBitCast_Word_Int32(word) @@ -89,7 +89,7 @@ final class BuiltinWordTests: XCTestCase { } func testBuiltinWord8() { - AssertParse( + assertParse( """ word = Builtin.trunc_Int128_Word(i128) word = Builtin.trunc_Int64_Word(i64) @@ -100,7 +100,7 @@ final class BuiltinWordTests: XCTestCase { } func testBuiltinWord9() { - AssertParse( + assertParse( """ i16 = Builtin.trunc_Word_Int16(word) i32 = Builtin.trunc_Word_Int32(word) @@ -111,7 +111,7 @@ final class BuiltinWordTests: XCTestCase { } func testBuiltinWord10() { - AssertParse( + assertParse( """ word = Builtin.zext_Int128_Word(i128) word = Builtin.zext_Int64_Word(i64) @@ -122,7 +122,7 @@ final class BuiltinWordTests: XCTestCase { } func testBuiltinWord11() { - AssertParse( + assertParse( """ i16 = Builtin.zext_Word_Int16(word) i32 = Builtin.zext_Word_Int32(word) diff --git a/Tests/SwiftParserTest/translated/ConflictMarkersTests.swift b/Tests/SwiftParserTest/translated/ConflictMarkersTests.swift index 9a3e12ae041..331aca7e9d2 100644 --- a/Tests/SwiftParserTest/translated/ConflictMarkersTests.swift +++ b/Tests/SwiftParserTest/translated/ConflictMarkersTests.swift @@ -16,7 +16,7 @@ import XCTest final class ConflictMarkersTests: XCTestCase { func testConflictMarkers1() { - AssertParse( + assertParse( """ // Conflict marker parsing should never conflict with operator parsing. """ @@ -24,7 +24,7 @@ final class ConflictMarkersTests: XCTestCase { } func testConflictMarkers2() { - AssertParse( + assertParse( """ prefix operator <<<<<<< infix operator <<<<<<< @@ -33,7 +33,7 @@ final class ConflictMarkersTests: XCTestCase { } func testConflictMarkers3() { - AssertParse( + assertParse( """ prefix func <<<<<<< (x : String) {} func <<<<<<< (x : String, y : String) {} @@ -42,7 +42,7 @@ final class ConflictMarkersTests: XCTestCase { } func testConflictMarkers4() { - AssertParse( + assertParse( """ prefix operator >>>>>>> infix operator >>>>>>> @@ -51,7 +51,7 @@ final class ConflictMarkersTests: XCTestCase { } func testConflictMarkers5() { - AssertParse( + assertParse( """ prefix func >>>>>>> (x : String) {} func >>>>>>> (x : String, y : String) {} @@ -60,7 +60,7 @@ final class ConflictMarkersTests: XCTestCase { } func testConflictMarkers6() { - AssertParse( + assertParse( """ // diff3-style conflict markers """ @@ -68,7 +68,7 @@ final class ConflictMarkersTests: XCTestCase { } func testConflictMarkers7() { - AssertParse( + assertParse( #""" 1️⃣<<<<<<< HEAD:conflict_markers.swift var a : String = "A" @@ -86,7 +86,7 @@ final class ConflictMarkersTests: XCTestCase { } func testConflictMarkers8() { - AssertParse( + assertParse( #""" 1️⃣<<<<<<< HEAD:conflict_markers.swift ======= @@ -101,7 +101,7 @@ final class ConflictMarkersTests: XCTestCase { } func testConflictMarkers9() { - AssertParse( + assertParse( #""" <<<<<<<"HEAD:fake_conflict_markers.swift" // No error >>>>>>>"18844bc65229786b96b89a9fc7739c0fc897905e:fake_conflict_markers.swift" // No error @@ -110,7 +110,7 @@ final class ConflictMarkersTests: XCTestCase { } func testConflictMarkers10() { - AssertParse( + assertParse( #""" 1️⃣<<<<<<< HEAD:conflict_markers.swift <<<<<<<"HEAD:fake_conflict_markers.swift" @@ -130,7 +130,7 @@ final class ConflictMarkersTests: XCTestCase { } func testConflictMarkers11() { - AssertParse( + assertParse( """ // Disambiguating conflict markers from operator applications. """ @@ -138,7 +138,7 @@ final class ConflictMarkersTests: XCTestCase { } func testConflictMarkers12() { - AssertParse( + assertParse( #""" _ = { // Conflict marker. @@ -161,7 +161,7 @@ final class ConflictMarkersTests: XCTestCase { } func testConflictMarkers13() { - AssertParse( + assertParse( """ // Perforce-style conflict markers """ @@ -169,7 +169,7 @@ final class ConflictMarkersTests: XCTestCase { } func testConflictMarkers14() { - AssertParse( + assertParse( #""" 1️⃣>>>> ORIGINAL var a : String = "A" @@ -190,7 +190,7 @@ final class ConflictMarkersTests: XCTestCase { } func testConflictMarkers15() { - AssertParse( + assertParse( #""" 1️⃣>>>> ORIGINAL ==== THEIRS diff --git a/Tests/SwiftParserTest/translated/ConsecutiveStatementsTests.swift b/Tests/SwiftParserTest/translated/ConsecutiveStatementsTests.swift index 3a7e11c9447..ca91b226255 100644 --- a/Tests/SwiftParserTest/translated/ConsecutiveStatementsTests.swift +++ b/Tests/SwiftParserTest/translated/ConsecutiveStatementsTests.swift @@ -16,7 +16,7 @@ import XCTest final class ConsecutiveStatementsTests: XCTestCase { func testSimple() { - AssertParse( + assertParse( "let x = 21️⃣ let y = 3", diagnostics: [ DiagnosticSpec(message: "consecutive statements on a line must be separated by ';'", fixIts: ["insert ';'"]) @@ -26,7 +26,7 @@ final class ConsecutiveStatementsTests: XCTestCase { } func testConsecutiveStatements1() { - AssertParse( + assertParse( """ func statement_starts() { var f : (Int) -> () @@ -46,7 +46,7 @@ final class ConsecutiveStatementsTests: XCTestCase { } func testConsecutiveStatements2() { - AssertParse( + assertParse( """ // Within a function func test(i: inout Int, j: inout Int) { @@ -69,7 +69,7 @@ final class ConsecutiveStatementsTests: XCTestCase { } func testConsecutiveStatements3() { - AssertParse( + assertParse( """ struct X { // In a sequence of declarations. @@ -99,7 +99,7 @@ final class ConsecutiveStatementsTests: XCTestCase { } func testConsecutiveStatements4() { - AssertParse( + assertParse( """ class C { // In a sequence of declarations. @@ -127,7 +127,7 @@ final class ConsecutiveStatementsTests: XCTestCase { } func testConsecutiveStatements5() { - AssertParse( + assertParse( """ protocol P { func a()1️⃣ func b() @@ -145,7 +145,7 @@ final class ConsecutiveStatementsTests: XCTestCase { } func testConsecutiveStatements6() { - AssertParse( + assertParse( """ enum Color { case Red1️⃣ case Blue @@ -166,7 +166,7 @@ final class ConsecutiveStatementsTests: XCTestCase { } func testConsecutiveStatements7() { - AssertParse( + assertParse( """ // At the top level var i, j : Int1️⃣ i = j2️⃣ j = i diff --git a/Tests/SwiftParserTest/translated/DebuggerTests.swift b/Tests/SwiftParserTest/translated/DebuggerTests.swift index fd7f381953e..37d7bbe05a2 100644 --- a/Tests/SwiftParserTest/translated/DebuggerTests.swift +++ b/Tests/SwiftParserTest/translated/DebuggerTests.swift @@ -16,7 +16,7 @@ import XCTest final class DebuggerTests: XCTestCase { func testDebugger1() { - AssertParse( + assertParse( """ import Nonexistent_Module """ @@ -24,7 +24,7 @@ final class DebuggerTests: XCTestCase { } func testDebugger2() { - AssertParse( + assertParse( """ var ($x0, $x1) = (4, 3) var z = $x0 + $x1 @@ -33,7 +33,7 @@ final class DebuggerTests: XCTestCase { } func testDebugger3() { - AssertParse( + assertParse( """ z // no error. """ @@ -41,7 +41,7 @@ final class DebuggerTests: XCTestCase { } func testDebugger4() { - AssertParse( + assertParse( """ var x: Double = z """ diff --git a/Tests/SwiftParserTest/translated/DelayedExtensionTests.swift b/Tests/SwiftParserTest/translated/DelayedExtensionTests.swift index c7bf23d8593..7ea8eb4010f 100644 --- a/Tests/SwiftParserTest/translated/DelayedExtensionTests.swift +++ b/Tests/SwiftParserTest/translated/DelayedExtensionTests.swift @@ -16,7 +16,7 @@ import XCTest final class DelayedExtensionTests: XCTestCase { func testDelayedExtension1() { - AssertParse( + assertParse( """ extension X { } _ = 1 diff --git a/Tests/SwiftParserTest/translated/DeprecatedWhereTests.swift b/Tests/SwiftParserTest/translated/DeprecatedWhereTests.swift index 9aaabf10737..2ddf8b03c22 100644 --- a/Tests/SwiftParserTest/translated/DeprecatedWhereTests.swift +++ b/Tests/SwiftParserTest/translated/DeprecatedWhereTests.swift @@ -18,7 +18,7 @@ import XCTest final class DeprecatedWhereTests: XCTestCase { func testDeprecatedWhere1() { - AssertParse( + assertParse( """ protocol Mashable { } protocol Womparable { } @@ -27,7 +27,7 @@ final class DeprecatedWhereTests: XCTestCase { } func testDeprecatedWhere2() { - AssertParse( + assertParse( """ // FuncDecl: Choose 0 func f1(x: T) {} @@ -36,7 +36,7 @@ final class DeprecatedWhereTests: XCTestCase { } func testDeprecatedWhere3() { - AssertParse( + assertParse( """ // FuncDecl: Choose 1 // 1: Inherited constraint @@ -52,7 +52,7 @@ final class DeprecatedWhereTests: XCTestCase { } func testDeprecatedWhere4() { - AssertParse( + assertParse( """ // FuncDecl: Choose 2 // 1,2 @@ -72,7 +72,7 @@ final class DeprecatedWhereTests: XCTestCase { } func testDeprecatedWhere5() { - AssertParse( + assertParse( """ // FuncDecl: Choose 3 // 1,2,3 @@ -86,7 +86,7 @@ final class DeprecatedWhereTests: XCTestCase { } func testDeprecatedWhere6() { - AssertParse( + assertParse( """ // FuncDecl: Choose 4 // 1,2,3,4 @@ -96,7 +96,7 @@ final class DeprecatedWhereTests: XCTestCase { } func testDeprecatedWhere7() { - AssertParse( + assertParse( """ // NominalTypeDecl: Choose 0 struct S0 {} @@ -105,7 +105,7 @@ final class DeprecatedWhereTests: XCTestCase { } func testDeprecatedWhere8() { - AssertParse( + assertParse( """ // NominalTypeDecl: Choose 1 // 1: Inherited constraint @@ -119,7 +119,7 @@ final class DeprecatedWhereTests: XCTestCase { } func testDeprecatedWhere9() { - AssertParse( + assertParse( """ // NominalTypeDecl: Choose 2 // 1,2 @@ -133,7 +133,7 @@ final class DeprecatedWhereTests: XCTestCase { } func testDeprecatedWhere10() { - AssertParse( + assertParse( """ // NominalTypeDecl: Choose 3 // 1,2,3 @@ -143,7 +143,7 @@ final class DeprecatedWhereTests: XCTestCase { } func testDeprecatedWhere11() { - AssertParse( + assertParse( """ protocol ProtoA {} protocol ProtoB {} @@ -156,7 +156,7 @@ final class DeprecatedWhereTests: XCTestCase { } func testDeprecatedWhere12() { - AssertParse( + assertParse( """ func testCombinedConstraintsOld where T: ProtoC4️⃣>(x: T) {} """, @@ -171,7 +171,7 @@ final class DeprecatedWhereTests: XCTestCase { } func testDeprecatedWhere13() { - AssertParse( + assertParse( """ func testCombinedConstraintsOld where T: ProtoC4️⃣>(x: T) where T: ProtoD {} """, diff --git a/Tests/SwiftParserTest/translated/DiagnoseAvailabilityTests.swift b/Tests/SwiftParserTest/translated/DiagnoseAvailabilityTests.swift index a520edbfb48..687171a2c87 100644 --- a/Tests/SwiftParserTest/translated/DiagnoseAvailabilityTests.swift +++ b/Tests/SwiftParserTest/translated/DiagnoseAvailabilityTests.swift @@ -16,7 +16,7 @@ import XCTest final class DiagnoseAvailabilityTests: XCTestCase { func testDiagnoseAvailability1() { - AssertParse( + assertParse( """ // https://github.com/apple/swift/issues/46814 // Misleading/wrong error message for malformed '@available' @@ -25,7 +25,7 @@ final class DiagnoseAvailabilityTests: XCTestCase { } func testDiagnoseAvailability2() { - AssertParse( + assertParse( """ @available(OSX 10.6, *) // no error func availableSince10_6() {} @@ -34,7 +34,7 @@ final class DiagnoseAvailabilityTests: XCTestCase { } func testDiagnoseAvailability3() { - AssertParse( + assertParse( """ @available(OSX, introduced: 10.0, deprecated: 10.12) // no error func introducedFollowedByDeprecated() {} @@ -43,7 +43,7 @@ final class DiagnoseAvailabilityTests: XCTestCase { } func testDiagnoseAvailability4() { - AssertParse( + assertParse( """ @available(OSX 10.0, deprecated: 10.12) func shorthandFollowedByDeprecated() {} @@ -52,7 +52,7 @@ final class DiagnoseAvailabilityTests: XCTestCase { } func testDiagnoseAvailability5() { - AssertParse( + assertParse( """ @available(OSX 10.0, introduced: 10.12) func shorthandFollowedByIntroduced() {} @@ -61,7 +61,7 @@ final class DiagnoseAvailabilityTests: XCTestCase { } func testDiagnoseAvailability6() { - AssertParse( + assertParse( """ @available(iOS 6.0, OSX 10.8, *) // no error func availableOnMultiplePlatforms() {} @@ -70,7 +70,7 @@ final class DiagnoseAvailabilityTests: XCTestCase { } func testDiagnoseAvailability7() { - AssertParse( + assertParse( """ @available(iOS 6.0, OSX 10.0, deprecated: 10.12) func twoShorthandsFollowedByDeprecated() {} @@ -79,7 +79,7 @@ final class DiagnoseAvailabilityTests: XCTestCase { } func testDiagnoseAvailability8() { - AssertParse( + assertParse( """ // https://github.com/apple/swift/issues/51114 // Missing/wrong warning message for '*' or 'swift' platform. @@ -88,7 +88,7 @@ final class DiagnoseAvailabilityTests: XCTestCase { } func testDiagnoseAvailability9() { - AssertParse( + assertParse( """ @available(*, deprecated: 4.2) func allPlatformsDeprecatedVersion() {} @@ -97,7 +97,7 @@ final class DiagnoseAvailabilityTests: XCTestCase { } func testDiagnoseAvailability10() { - AssertParse( + assertParse( """ @available(*, deprecated, obsoleted: 4.2) func allPlatformsDeprecatedAndObsoleted() {} @@ -106,7 +106,7 @@ final class DiagnoseAvailabilityTests: XCTestCase { } func testDiagnoseAvailability11() { - AssertParse( + assertParse( """ @available(*, introduced: 4.0, deprecated: 4.1, obsoleted: 4.2) func allPlatformsDeprecatedAndObsoleted2() {} @@ -115,7 +115,7 @@ final class DiagnoseAvailabilityTests: XCTestCase { } func testDiagnoseAvailability12() { - AssertParse( + assertParse( """ @available(swift, unavailable) func swiftUnavailable() {} @@ -124,7 +124,7 @@ final class DiagnoseAvailabilityTests: XCTestCase { } func testDiagnoseAvailability13() { - AssertParse( + assertParse( """ @available(swift, unavailable, introduced: 4.2) func swiftUnavailableIntroduced() {} @@ -133,7 +133,7 @@ final class DiagnoseAvailabilityTests: XCTestCase { } func testDiagnoseAvailability14() { - AssertParse( + assertParse( """ @available(swift, deprecated) func swiftDeprecated() {} @@ -142,7 +142,7 @@ final class DiagnoseAvailabilityTests: XCTestCase { } func testDiagnoseAvailability15() { - AssertParse( + assertParse( """ @available(swift, deprecated, obsoleted: 4.2) func swiftDeprecatedObsoleted() {} @@ -151,7 +151,7 @@ final class DiagnoseAvailabilityTests: XCTestCase { } func testDiagnoseAvailability16() { - AssertParse( + assertParse( #""" @available(swift, message: "missing valid option") func swiftMessage() {} @@ -160,7 +160,7 @@ final class DiagnoseAvailabilityTests: XCTestCase { } func testDiagnoseAvailability17() { - AssertParse( + assertParse( #""" @available(*, unavailable, message: "\("message")") func interpolatedMessage() {} @@ -172,7 +172,7 @@ final class DiagnoseAvailabilityTests: XCTestCase { } func testDiagnoseAvailability18() { - AssertParse( + assertParse( #""" @available(*, unavailable, message: """ foobar message. @@ -184,7 +184,7 @@ final class DiagnoseAvailabilityTests: XCTestCase { } func testDiagnoseAvailability19() { - AssertParse( + assertParse( #""" @available(*, unavailable, message: " ") func emptyMessage() {} @@ -194,7 +194,7 @@ final class DiagnoseAvailabilityTests: XCTestCase { } func testDiagnoseAvailability20() { - AssertParse( + assertParse( ##""" @available(*, unavailable, message: #""" foobar message. @@ -208,7 +208,7 @@ final class DiagnoseAvailabilityTests: XCTestCase { } func testDiagnoseAvailability21() { - AssertParse( + assertParse( ##""" @available(*, unavailable, renamed: #"available()"#) func extendedEscapedRenamed() {} diff --git a/Tests/SwiftParserTest/translated/DiagnoseAvailabilityWindowsTests.swift b/Tests/SwiftParserTest/translated/DiagnoseAvailabilityWindowsTests.swift index 43f13aa70f1..b0d1afaf0ef 100644 --- a/Tests/SwiftParserTest/translated/DiagnoseAvailabilityWindowsTests.swift +++ b/Tests/SwiftParserTest/translated/DiagnoseAvailabilityWindowsTests.swift @@ -16,7 +16,7 @@ import XCTest final class DiagnoseAvailabilityWindowsTests: XCTestCase { func testDiagnoseAvailabilityWindows1() { - AssertParse( + assertParse( #""" @available(Windows, unavailable, message: "unsupported") func unavailable() {} @@ -25,7 +25,7 @@ final class DiagnoseAvailabilityWindowsTests: XCTestCase { } func testDiagnoseAvailabilityWindows2() { - AssertParse( + assertParse( """ unavailable() """ @@ -33,7 +33,7 @@ final class DiagnoseAvailabilityWindowsTests: XCTestCase { } func testDiagnoseAvailabilityWindows3() { - AssertParse( + assertParse( """ @available(Windows, introduced: 10.0.17763, deprecated: 10.0.19140) func introduced_deprecated() {} @@ -42,7 +42,7 @@ final class DiagnoseAvailabilityWindowsTests: XCTestCase { } func testDiagnoseAvailabilityWindows4() { - AssertParse( + assertParse( """ introduced_deprecated() """ @@ -50,7 +50,7 @@ final class DiagnoseAvailabilityWindowsTests: XCTestCase { } func testDiagnoseAvailabilityWindows5() { - AssertParse( + assertParse( """ @available(Windows 10, *) func windows10() {} @@ -59,7 +59,7 @@ final class DiagnoseAvailabilityWindowsTests: XCTestCase { } func testDiagnoseAvailabilityWindows6() { - AssertParse( + assertParse( """ windows10() """ @@ -67,7 +67,7 @@ final class DiagnoseAvailabilityWindowsTests: XCTestCase { } func testDiagnoseAvailabilityWindows7() { - AssertParse( + assertParse( """ func conditional_compilation() { if #available(Windows 10, *) { diff --git a/Tests/SwiftParserTest/translated/DiagnoseDynamicReplacementTests.swift b/Tests/SwiftParserTest/translated/DiagnoseDynamicReplacementTests.swift index d9efb72641a..acba50d0941 100644 --- a/Tests/SwiftParserTest/translated/DiagnoseDynamicReplacementTests.swift +++ b/Tests/SwiftParserTest/translated/DiagnoseDynamicReplacementTests.swift @@ -16,7 +16,7 @@ import XCTest final class DiagnoseDynamicReplacementTests: XCTestCase { func testDiagnoseDynamicReplacement1() { - AssertParse( + assertParse( """ dynamic func dynamic_replaceable() { } @@ -25,7 +25,7 @@ final class DiagnoseDynamicReplacementTests: XCTestCase { } func testDiagnoseDynamicReplacement2() { - AssertParse( + assertParse( """ @_dynamicReplacement1️⃣ func test_dynamic_replacement_for() { @@ -38,7 +38,7 @@ final class DiagnoseDynamicReplacementTests: XCTestCase { } func testDiagnoseDynamicReplacement3() { - AssertParse( + assertParse( """ @_dynamicReplacement(1️⃣ func test_dynamic_replacement_for2() { @@ -52,7 +52,7 @@ final class DiagnoseDynamicReplacementTests: XCTestCase { } func testDiagnoseDynamicReplacement4() { - AssertParse( + assertParse( """ @_dynamicReplacementℹ️(for: dynamically_replaceable() 1️⃣ func test_dynamic_replacement_for3() { diff --git a/Tests/SwiftParserTest/translated/DiagnoseInitializerAsTypedPatternTests.swift b/Tests/SwiftParserTest/translated/DiagnoseInitializerAsTypedPatternTests.swift index 9f6a600d203..2f0afb23aec 100644 --- a/Tests/SwiftParserTest/translated/DiagnoseInitializerAsTypedPatternTests.swift +++ b/Tests/SwiftParserTest/translated/DiagnoseInitializerAsTypedPatternTests.swift @@ -17,7 +17,7 @@ import XCTest // https://github.com/apple/swift/issues/44070 final class DiagnoseInitializerAsTypedPatternTests: XCTestCase { func testDiagnoseInitializerAsTypedPattern3a() { - AssertParse( + assertParse( """ let a1️⃣:[X]() """, @@ -29,7 +29,7 @@ final class DiagnoseInitializerAsTypedPatternTests: XCTestCase { } func testDiagnoseInitializerAsTypedPattern3b() { - AssertParse( + assertParse( """ let b1️⃣: [X]() """, @@ -41,7 +41,7 @@ final class DiagnoseInitializerAsTypedPatternTests: XCTestCase { } func testDiagnoseInitializerAsTypedPattern3c() { - AssertParse( + assertParse( """ let c 1️⃣:[X]() """, @@ -53,7 +53,7 @@ final class DiagnoseInitializerAsTypedPatternTests: XCTestCase { } func testDiagnoseInitializerAsTypedPattern3d() { - AssertParse( + assertParse( """ let d 1️⃣: [X]() """, @@ -65,7 +65,7 @@ final class DiagnoseInitializerAsTypedPatternTests: XCTestCase { } func testDiagnoseInitializerAsTypedPattern4() { - AssertParse( + assertParse( """ let e1️⃣: X(), ee: Int """, @@ -77,7 +77,7 @@ final class DiagnoseInitializerAsTypedPatternTests: XCTestCase { } func testDiagnoseInitializerAsTypedPattern5a() { - AssertParse( + assertParse( """ let f1️⃣:/*comment*/[X]() """, @@ -89,7 +89,7 @@ final class DiagnoseInitializerAsTypedPatternTests: XCTestCase { } func testDiagnoseInitializerAsTypedPattern5b() { - AssertParse( + assertParse( """ let f/*comment*/1️⃣:[X]() """, @@ -101,7 +101,7 @@ final class DiagnoseInitializerAsTypedPatternTests: XCTestCase { } func testDiagnoseInitializerAsTypedPattern6() { - AssertParse( + assertParse( """ var _1 = 1, _2 = 2 """ @@ -110,7 +110,7 @@ final class DiagnoseInitializerAsTypedPatternTests: XCTestCase { func testDiagnoseInitializerAsTypedPattern7() { // paren follows the type, but it's part of a separate (valid) expression - AssertParse( + assertParse( """ let ff: X (_1, _2) = (_2, _1) @@ -121,7 +121,7 @@ final class DiagnoseInitializerAsTypedPatternTests: XCTestCase { } func testDiagnoseInitializerAsTypedPattern8a() { - AssertParse( + assertParse( """ let g1️⃣: X(x) """, @@ -132,7 +132,7 @@ final class DiagnoseInitializerAsTypedPatternTests: XCTestCase { } func testDiagnoseInitializerAsTypedPattern8b() { - AssertParse( + assertParse( """ let h1️⃣: X(x, y) """, @@ -143,7 +143,7 @@ final class DiagnoseInitializerAsTypedPatternTests: XCTestCase { } func testDiagnoseInitializerAsTypedPattern8c() { - AssertParse( + assertParse( """ let i1️⃣: X() { foo() } """, @@ -154,7 +154,7 @@ final class DiagnoseInitializerAsTypedPatternTests: XCTestCase { } func testDiagnoseInitializerAsTypedPattern8d() { - AssertParse( + assertParse( """ let j1️⃣: X(x) { foo() } """, @@ -165,7 +165,7 @@ final class DiagnoseInitializerAsTypedPatternTests: XCTestCase { } func testDiagnoseInitializerAsTypedPattern8e() { - AssertParse( + assertParse( """ let k1️⃣: X(x, y) { foo() } """, @@ -176,7 +176,7 @@ final class DiagnoseInitializerAsTypedPatternTests: XCTestCase { } func testDiagnoseInitializerAsTypedPattern9a() { - AssertParse( + assertParse( """ func nonTopLevel() { let a1️⃣:[X]() @@ -189,7 +189,7 @@ final class DiagnoseInitializerAsTypedPatternTests: XCTestCase { } func testDiagnoseInitializerAsTypedPattern9b() { - AssertParse( + assertParse( """ func nonTopLevel() { let i1️⃣: X() { foo() } @@ -202,7 +202,7 @@ final class DiagnoseInitializerAsTypedPatternTests: XCTestCase { } func testDiagnoseInitializerAsTypedPattern9c() { - AssertParse( + assertParse( """ func nonTopLevel() { let j1️⃣: X(x) { foo() } @@ -215,7 +215,7 @@ final class DiagnoseInitializerAsTypedPatternTests: XCTestCase { } func testDiagnoseInitializerAsTypedPattern9d() { - AssertParse( + assertParse( """ func nonTopLevel() { let k1️⃣: X(x, y) { foo() } @@ -228,7 +228,7 @@ final class DiagnoseInitializerAsTypedPatternTests: XCTestCase { } func testDiagnoseInitializerAsTypedPattern9e() { - AssertParse( + assertParse( """ func nonTopLevel() { _ = (a, i, j, k) diff --git a/Tests/SwiftParserTest/translated/DiagnosticMissingFuncKeywordTests.swift b/Tests/SwiftParserTest/translated/DiagnosticMissingFuncKeywordTests.swift index b2b347cbcbb..0289b5614da 100644 --- a/Tests/SwiftParserTest/translated/DiagnosticMissingFuncKeywordTests.swift +++ b/Tests/SwiftParserTest/translated/DiagnosticMissingFuncKeywordTests.swift @@ -17,7 +17,7 @@ import XCTest final class DiagnosticMissingFuncKeywordTests: XCTestCase { func testDiagnosticMissingFuncKeyword2a() { // https://github.com/apple/swift/issues/52877 - AssertParse( + assertParse( """ protocol Brew { 1️⃣tripel() -> Int @@ -36,7 +36,7 @@ final class DiagnosticMissingFuncKeywordTests: XCTestCase { func testDiagnosticMissingFuncKeyword2b() { // https://github.com/apple/swift/issues/52877 - AssertParse( + assertParse( """ protocol Brew { 1️⃣quadrupel: Int { get } @@ -55,7 +55,7 @@ final class DiagnosticMissingFuncKeywordTests: XCTestCase { func testDiagnosticMissingFuncKeyword2c() { // https://github.com/apple/swift/issues/52877 - AssertParse( + assertParse( """ protocol Brew { static 1️⃣+ (lhs: Self, rhs: Self) -> Self @@ -74,7 +74,7 @@ final class DiagnosticMissingFuncKeywordTests: XCTestCase { func testDiagnosticMissingFuncKeyword2d() { // https://github.com/apple/swift/issues/52877 - AssertParse( + assertParse( """ protocol Brew { 1️⃣* (lhs: Self, rhs: Self) -> Self @@ -93,7 +93,7 @@ final class DiagnosticMissingFuncKeywordTests: XCTestCase { func testDiagnosticMissingFuncKeyword2e() { // https://github.com/apple/swift/issues/52877 - AssertParse( + assertParse( """ protocol Brew { 1️⃣ipa: Int { get }; 2️⃣apa: Float { get } @@ -113,7 +113,7 @@ final class DiagnosticMissingFuncKeywordTests: XCTestCase { func testDiagnosticMissingFuncKeyword2f() { // https://github.com/apple/swift/issues/52877 - AssertParse( + assertParse( """ protocol Brew { 1️⃣stout: Int { get } 2️⃣porter: Float { get } @@ -132,7 +132,7 @@ final class DiagnosticMissingFuncKeywordTests: XCTestCase { } func testDiagnosticMissingFuncKeyword3() { - AssertParse( + assertParse( """ infix operator %% """ @@ -140,7 +140,7 @@ final class DiagnosticMissingFuncKeywordTests: XCTestCase { } func testDiagnosticMissingFuncKeyword4a() { - AssertParse( + assertParse( """ struct Bar { 1️⃣fisr = 0x5F3759DF @@ -153,7 +153,7 @@ final class DiagnosticMissingFuncKeywordTests: XCTestCase { } func testDiagnosticMissingFuncKeyword4b() { - AssertParse( + assertParse( """ struct Bar { 1️⃣%% (lhs: T, rhs: T) -> T { @@ -168,7 +168,7 @@ final class DiagnosticMissingFuncKeywordTests: XCTestCase { } func testDiagnosticMissingFuncKeyword4c() { - AssertParse( + assertParse( """ struct Bar { 1️⃣_: Int = 42 @@ -181,7 +181,7 @@ final class DiagnosticMissingFuncKeywordTests: XCTestCase { } func testDiagnosticMissingFuncKeyword4d() { - AssertParse( + assertParse( """ struct Bar { 1️⃣(light, dark) = (100, 200) @@ -194,7 +194,7 @@ final class DiagnosticMissingFuncKeywordTests: XCTestCase { } func testDiagnosticMissingFuncKeyword4e() { - AssertParse( + assertParse( """ struct Bar { 1️⃣a, b: Int @@ -212,7 +212,7 @@ final class DiagnosticMissingFuncKeywordTests: XCTestCase { } func testDiagnosticMissingFuncKeyword5a() { - AssertParse( + assertParse( """ class Baz { 1️⃣instanceMethod() {} @@ -225,7 +225,7 @@ final class DiagnosticMissingFuncKeywordTests: XCTestCase { } func testDiagnosticMissingFuncKeyword5b() { - AssertParse( + assertParse( """ class Baz { static 1️⃣staticMethod() {} @@ -238,7 +238,7 @@ final class DiagnosticMissingFuncKeywordTests: XCTestCase { } func testDiagnosticMissingFuncKeyword5c() { - AssertParse( + assertParse( """ class Baz { 1️⃣instanceProperty: Int { 0 } @@ -251,7 +251,7 @@ final class DiagnosticMissingFuncKeywordTests: XCTestCase { } func testDiagnosticMissingFuncKeyword5d() { - AssertParse( + assertParse( """ class Baz { static 1️⃣staticProperty: Int { 0 } @@ -264,7 +264,7 @@ final class DiagnosticMissingFuncKeywordTests: XCTestCase { } func testDiagnosticMissingFuncKeyword6() { - AssertParse( + assertParse( """ class C1 { class classMethod1️⃣() {} @@ -277,7 +277,7 @@ final class DiagnosticMissingFuncKeywordTests: XCTestCase { } func testDiagnosticMissingFuncKeyword7() { - AssertParse( + assertParse( """ class C2 { class classProperty: Int { 1️⃣0 } diff --git a/Tests/SwiftParserTest/translated/DollarIdentifierTests.swift b/Tests/SwiftParserTest/translated/DollarIdentifierTests.swift index a4f78729052..5ad240df9d3 100644 --- a/Tests/SwiftParserTest/translated/DollarIdentifierTests.swift +++ b/Tests/SwiftParserTest/translated/DollarIdentifierTests.swift @@ -16,7 +16,7 @@ import XCTest final class DollarIdentifierTests: XCTestCase { func testDollarIdentifier1() { - AssertParse( + assertParse( """ // https://github.com/apple/swift/issues/44270 // Dollar was accidentally allowed as an identifier in Swift 3. @@ -26,7 +26,7 @@ final class DollarIdentifierTests: XCTestCase { } func testDollarIdentifier2a() { - AssertParse( + assertParse( """ func dollarVar() { var 1️⃣$ : Int = 42 @@ -41,7 +41,7 @@ final class DollarIdentifierTests: XCTestCase { } func testDollarIdentifier2b() { - AssertParse( + assertParse( """ func dollarLet() { let 1️⃣$ = 42 @@ -55,7 +55,7 @@ final class DollarIdentifierTests: XCTestCase { } func testDollarIdentifier2c() { - AssertParse( + assertParse( """ func dollarClass() { class 1️⃣$ {} @@ -73,7 +73,7 @@ final class DollarIdentifierTests: XCTestCase { } func testDollarIdentifier2d() { - AssertParse( + assertParse( """ func dollarEnum() { enum 1️⃣$ {} @@ -86,7 +86,7 @@ final class DollarIdentifierTests: XCTestCase { } func testDollarIdentifier2e() { - AssertParse( + assertParse( """ func dollarStruct() { struct 1️⃣$ {} @@ -99,7 +99,7 @@ final class DollarIdentifierTests: XCTestCase { } func testDollarIdentifier3a() { - AssertParse( + assertParse( """ func 1️⃣$(2️⃣$ dollarParam: Int) {} """, @@ -112,7 +112,7 @@ final class DollarIdentifierTests: XCTestCase { } func testDollarIdentifier3b() { - AssertParse( + assertParse( """ $(1️⃣$: 24) """, @@ -123,7 +123,7 @@ final class DollarIdentifierTests: XCTestCase { } func testDollarIdentifier4() { - AssertParse( + assertParse( """ func escapedDollarVar() { var `$` : Int = 42 // no error @@ -148,7 +148,7 @@ final class DollarIdentifierTests: XCTestCase { } func testDollarIdentifier5() { - AssertParse( + assertParse( """ func escapedDollarFunc() { func `$`(`$`: Int) {} // no error @@ -159,7 +159,7 @@ final class DollarIdentifierTests: XCTestCase { } func testDollarIdentifier6() { - AssertParse( + assertParse( """ func escapedDollarAnd() { // FIXME: Bad diagnostics. @@ -175,7 +175,7 @@ final class DollarIdentifierTests: XCTestCase { } func testDollarIdentifier7() { - AssertParse( + assertParse( """ // Test that we disallow user-defined $-prefixed identifiers. However, the error // should not be emitted on $-prefixed identifiers that are not considered @@ -185,7 +185,7 @@ final class DollarIdentifierTests: XCTestCase { } func testDollarIdentifier8() { - AssertParse( + assertParse( """ func $declareWithDollar() { var $foo: Int { @@ -229,7 +229,7 @@ final class DollarIdentifierTests: XCTestCase { } func testDollarIdentifier9() { - AssertParse( + assertParse( """ // https://github.com/apple/swift/issues/55672 """ @@ -237,7 +237,7 @@ final class DollarIdentifierTests: XCTestCase { } func testDollarIdentifier10() { - AssertParse( + assertParse( """ @propertyWrapper struct Wrapper { @@ -249,7 +249,7 @@ final class DollarIdentifierTests: XCTestCase { } func testDollarIdentifier11() { - AssertParse( + assertParse( """ struct S { @Wrapper var café = 42 @@ -259,7 +259,7 @@ final class DollarIdentifierTests: XCTestCase { } func testDollarIdentifier12() { - AssertParse( + assertParse( """ let _ = S().$café // Okay """ @@ -268,7 +268,7 @@ final class DollarIdentifierTests: XCTestCase { func testDollarIdentifier13() { // https://github.com/apple/swift/issues/55538 - AssertParse( + assertParse( """ infix operator 1️⃣$ """, @@ -280,7 +280,7 @@ final class DollarIdentifierTests: XCTestCase { func testDollarIdentifier14() { // https://github.com/apple/swift/issues/55538 - AssertParse( + assertParse( """ infix operator 1️⃣`$` """, diff --git a/Tests/SwiftParserTest/translated/EffectfulPropertiesTests.swift b/Tests/SwiftParserTest/translated/EffectfulPropertiesTests.swift index 14d4809583f..a94edf20fbc 100644 --- a/Tests/SwiftParserTest/translated/EffectfulPropertiesTests.swift +++ b/Tests/SwiftParserTest/translated/EffectfulPropertiesTests.swift @@ -16,7 +16,7 @@ import XCTest final class EffectfulPropertiesTests: XCTestCase { func testEffectfulProperties1() { - AssertParse( + assertParse( """ struct MyProps { var prop1 : Int { @@ -43,7 +43,7 @@ final class EffectfulPropertiesTests: XCTestCase { } func testEffectfulProperties2() { - AssertParse( + assertParse( """ struct X1 { subscript(_ i : Int) -> Int { @@ -55,7 +55,7 @@ final class EffectfulPropertiesTests: XCTestCase { } func testEffectfulProperties3() { - AssertParse( + assertParse( """ class X2 { subscript(_ i : Int) -> Int { @@ -67,7 +67,7 @@ final class EffectfulPropertiesTests: XCTestCase { } func testEffectfulProperties4() { - AssertParse( + assertParse( """ struct X3 { subscript(_ i : Int) -> Int { @@ -79,7 +79,7 @@ final class EffectfulPropertiesTests: XCTestCase { } func testEffectfulProperties5() { - AssertParse( + assertParse( """ struct BadSubscript1 { subscript(_ i : Int) -> Int { @@ -92,7 +92,7 @@ final class EffectfulPropertiesTests: XCTestCase { } func testEffectfulProperties6() { - AssertParse( + assertParse( """ struct BadSubscript2 { subscript(_ i : Int) -> Int { @@ -105,7 +105,7 @@ final class EffectfulPropertiesTests: XCTestCase { } func testEffectfulProperties7() { - AssertParse( + assertParse( """ struct S { var prop2 : Int { @@ -118,7 +118,7 @@ final class EffectfulPropertiesTests: XCTestCase { } func testEffectfulProperties8() { - AssertParse( + assertParse( """ var prop3 : Bool { _read { yield prop3 } @@ -131,7 +131,7 @@ final class EffectfulPropertiesTests: XCTestCase { } func testEffectfulProperties9() { - AssertParse( + assertParse( """ enum E { private(set) var prop4 : Double { @@ -145,7 +145,7 @@ final class EffectfulPropertiesTests: XCTestCase { } func testEffectfulProperties10() { - AssertParse( + assertParse( """ protocol P { associatedtype T @@ -162,7 +162,7 @@ final class EffectfulPropertiesTests: XCTestCase { } func testEffectfulProperties11() { - AssertParse( + assertParse( """ /////////////////// // invalid syntax @@ -171,7 +171,7 @@ final class EffectfulPropertiesTests: XCTestCase { } func testEffectfulProperties12() { - AssertParse( + assertParse( """ var bad1 : Int { get rethrows { 0 } @@ -185,7 +185,7 @@ final class EffectfulPropertiesTests: XCTestCase { } func testEffectfulProperties13() { - AssertParse( + assertParse( """ var bad2 : Int { get reasync { 0 } @@ -199,7 +199,7 @@ final class EffectfulPropertiesTests: XCTestCase { } func testEffectfulProperties14() { - AssertParse( + assertParse( """ var bad3 : Int { _read async { yield 0 } @@ -210,7 +210,7 @@ final class EffectfulPropertiesTests: XCTestCase { } func testEffectfulProperties15a() { - AssertParse( + assertParse( """ var bad4 : Int = 0 { willSet(theValue) 3️⃣reasync 4️⃣rethrows 1️⃣async 2️⃣throws {} @@ -224,7 +224,7 @@ final class EffectfulPropertiesTests: XCTestCase { } func testEffectfulProperties15b() { - AssertParse( + assertParse( """ var bad4 : Int = 0 { didSet throws 1️⃣bogus {} @@ -237,7 +237,7 @@ final class EffectfulPropertiesTests: XCTestCase { } func testEffectfulProperties16() { - AssertParse( + assertParse( """ var bad5 : Int { get 1️⃣bogus rethrows {} @@ -250,7 +250,7 @@ final class EffectfulPropertiesTests: XCTestCase { } func testEffectfulProperties17() { - AssertParse( + assertParse( """ var bad6 : Int { get rethrows 1️⃣-> Int { 0 } @@ -263,7 +263,7 @@ final class EffectfulPropertiesTests: XCTestCase { } func testEffectfulProperties18() { - AssertParse( + assertParse( """ var bad7 : Double { get throws 1️⃣async { 3.14 } @@ -276,7 +276,7 @@ final class EffectfulPropertiesTests: XCTestCase { } func testEffectfulProperties19() { - AssertParse( + assertParse( """ var bad8 : Double { get {} @@ -290,7 +290,7 @@ final class EffectfulPropertiesTests: XCTestCase { } func testEffectfulProperties20() { - AssertParse( + assertParse( """ protocol BadP { var prop2 : Int { get 1️⃣bogus rethrows set } diff --git a/Tests/SwiftParserTest/translated/EnumElementPatternSwift4Tests.swift b/Tests/SwiftParserTest/translated/EnumElementPatternSwift4Tests.swift index ba2b606f9e3..d5063eda94c 100644 --- a/Tests/SwiftParserTest/translated/EnumElementPatternSwift4Tests.swift +++ b/Tests/SwiftParserTest/translated/EnumElementPatternSwift4Tests.swift @@ -16,7 +16,7 @@ import XCTest final class EnumElementPatternSwift4Tests: XCTestCase { func testEnumElementPatternSwift41() { - AssertParse( + assertParse( """ // https://github.com/apple/swift/issues/46040 // See test/Compatibility/enum_element_pattern.swift for Swift3 behavior. @@ -26,7 +26,7 @@ final class EnumElementPatternSwift4Tests: XCTestCase { } func testEnumElementPatternSwift42() { - AssertParse( + assertParse( """ enum E { case A, B, C, D @@ -46,7 +46,7 @@ final class EnumElementPatternSwift4Tests: XCTestCase { } func testEnumElementPatternSwift43() { - AssertParse( + assertParse( """ func testE(e: E) { switch e { @@ -72,7 +72,7 @@ final class EnumElementPatternSwift4Tests: XCTestCase { } func testEnumElementPatternSwift44() { - AssertParse( + assertParse( """ extension E : Error {} func canThrow() throws { @@ -83,7 +83,7 @@ final class EnumElementPatternSwift4Tests: XCTestCase { } func testEnumElementPatternSwift45() { - AssertParse( + assertParse( """ do { try canThrow() diff --git a/Tests/SwiftParserTest/translated/EnumTests.swift b/Tests/SwiftParserTest/translated/EnumTests.swift index 3ee96778579..d1b3d28a830 100644 --- a/Tests/SwiftParserTest/translated/EnumTests.swift +++ b/Tests/SwiftParserTest/translated/EnumTests.swift @@ -16,7 +16,7 @@ import XCTest final class EnumTests: XCTestCase { func testEnum1() { - AssertParse( + assertParse( """ // FIXME: this test only passes on platforms which have Float80. // Floating point enum raw values are not portable @@ -25,7 +25,7 @@ final class EnumTests: XCTestCase { } func testEnum2() { - AssertParse( + assertParse( """ // Windows does not support FP80 // XFAIL: OS=windows-msvc @@ -34,7 +34,7 @@ final class EnumTests: XCTestCase { } func testEnum3() { - AssertParse( + assertParse( """ enum Empty {} """ @@ -42,7 +42,7 @@ final class EnumTests: XCTestCase { } func testEnum4() { - AssertParse( + assertParse( """ enum Boolish { case falsy @@ -54,7 +54,7 @@ final class EnumTests: XCTestCase { } func testEnum5() { - AssertParse( + assertParse( """ var b = Boolish.falsy b = .truthy @@ -63,7 +63,7 @@ final class EnumTests: XCTestCase { } func testEnum6() { - AssertParse( + assertParse( """ enum Optionable { case Nought @@ -74,7 +74,7 @@ final class EnumTests: XCTestCase { } func testEnum7() { - AssertParse( + assertParse( """ var o = Optionable.Nought o = .Mere(0) @@ -83,7 +83,7 @@ final class EnumTests: XCTestCase { } func testEnum8() { - AssertParse( + assertParse( """ enum Color { case Red, Green, Grayscale(Int), Blue } """ @@ -91,7 +91,7 @@ final class EnumTests: XCTestCase { } func testEnum9() { - AssertParse( + assertParse( """ var c = Color.Red c = .Green @@ -102,7 +102,7 @@ final class EnumTests: XCTestCase { } func testEnum10() { - AssertParse( + assertParse( """ let partialApplication = Color.Grayscale """ @@ -110,7 +110,7 @@ final class EnumTests: XCTestCase { } func testEnum11() { - AssertParse( + assertParse( """ // Cases are excluded from non-enums. 1️⃣case FloatingCase @@ -122,7 +122,7 @@ final class EnumTests: XCTestCase { } func testEnum12() { - AssertParse( + assertParse( """ struct SomeStruct { case StructCase @@ -132,7 +132,7 @@ final class EnumTests: XCTestCase { } func testEnum13() { - AssertParse( + assertParse( """ class SomeClass { case ClassCase @@ -142,7 +142,7 @@ final class EnumTests: XCTestCase { } func testEnum14() { - AssertParse( + assertParse( """ enum EnumWithExtension1 { case A1 @@ -155,7 +155,7 @@ final class EnumTests: XCTestCase { } func testEnum15() { - AssertParse( + assertParse( """ // Attributes for enum cases. """ @@ -163,7 +163,7 @@ final class EnumTests: XCTestCase { } func testEnum16() { - AssertParse( + assertParse( """ enum EnumCaseAttributes { @xyz case EmptyAttributes @@ -174,7 +174,7 @@ final class EnumTests: XCTestCase { // Recover when a switch 'case' label is spelled inside an enum (or outside). func testEnum17a() { - AssertParse( + assertParse( """ enum SwitchEnvy { case X1️⃣: @@ -187,7 +187,7 @@ final class EnumTests: XCTestCase { } func testEnum17b() { - AssertParse( + assertParse( """ enum SwitchEnvy { case X(Y)1️⃣: @@ -200,7 +200,7 @@ final class EnumTests: XCTestCase { } func testEnum17c() { - AssertParse( + assertParse( """ enum SwitchEnvy { case X, Y1️⃣: @@ -213,7 +213,7 @@ final class EnumTests: XCTestCase { } func testEnum17d() { - AssertParse( + assertParse( """ enum SwitchEnvy { case X 1️⃣where true: @@ -226,7 +226,7 @@ final class EnumTests: XCTestCase { } func testEnum17e() { - AssertParse( + assertParse( """ enum SwitchEnvy { case X(Y), Z(W)1️⃣: @@ -239,7 +239,7 @@ final class EnumTests: XCTestCase { } func testEnum17f() { - AssertParse( + assertParse( """ enum SwitchEnvy { case X(Y) 1️⃣where true: @@ -252,7 +252,7 @@ final class EnumTests: XCTestCase { } func testEnum17g() { - AssertParse( + assertParse( """ enum SwitchEnvy { case 1️⃣02️⃣: @@ -266,7 +266,7 @@ final class EnumTests: XCTestCase { } func testEnum17h() { - AssertParse( + assertParse( """ enum SwitchEnvy { case 1️⃣_2️⃣: @@ -280,7 +280,7 @@ final class EnumTests: XCTestCase { } func testEnum17i() { - AssertParse( + assertParse( """ enum SwitchEnvy { case 1️⃣(_, var x2️⃣, 3️⃣0)4️⃣: @@ -302,7 +302,7 @@ final class EnumTests: XCTestCase { } func testEnum18() { - AssertParse( + assertParse( """ enum HasMethodsPropertiesAndCtors { case TweedleDee @@ -322,7 +322,7 @@ final class EnumTests: XCTestCase { } func testEnum19() { - AssertParse( + assertParse( """ enum ImproperlyHasIVars { case Flopsy @@ -334,7 +334,7 @@ final class EnumTests: XCTestCase { } func testEnum20() { - AssertParse( + assertParse( """ // We used to crash on this. rdar://14678675 enum rdar14678675 { @@ -350,7 +350,7 @@ final class EnumTests: XCTestCase { } func testEnum21a() { - AssertParse( + assertParse( """ enum Recovery1 { case1️⃣: @@ -364,7 +364,7 @@ final class EnumTests: XCTestCase { } func testEnum21b() { - AssertParse( + assertParse( """ enum Recovery2 { case UE11️⃣: @@ -377,7 +377,7 @@ final class EnumTests: XCTestCase { } func testEnum21c() { - AssertParse( + assertParse( """ enum Recovery3 { case UE2(Void)1️⃣: @@ -390,7 +390,7 @@ final class EnumTests: XCTestCase { } func testEnum21d() { - AssertParse( + assertParse( """ enum Recovery4 { case 1️⃣Self 2️⃣Self @@ -404,7 +404,7 @@ final class EnumTests: XCTestCase { } func testEnum21e() { - AssertParse( + assertParse( """ enum Recovery5 { case 1️⃣.UE3 @@ -420,7 +420,7 @@ final class EnumTests: XCTestCase { } func testEnum21f() { - AssertParse( + assertParse( """ enum Recovery6 { case Snout, 1️⃣_; @@ -437,7 +437,7 @@ final class EnumTests: XCTestCase { } func testEnum22() { - AssertParse( + assertParse( """ enum RawTypeEmpty : Int {} """ @@ -445,7 +445,7 @@ final class EnumTests: XCTestCase { } func testEnum23() { - AssertParse( + assertParse( """ enum Raw : Int { case Ankeny, Burnside @@ -455,7 +455,7 @@ final class EnumTests: XCTestCase { } func testEnum24() { - AssertParse( + assertParse( """ enum MultiRawType : Int64, Int32 { case Couch, Davis @@ -465,7 +465,7 @@ final class EnumTests: XCTestCase { } func testEnum25() { - AssertParse( + assertParse( """ protocol RawTypeNotFirstProtocol {} enum RawTypeNotFirst : RawTypeNotFirstProtocol, Int { @@ -476,7 +476,7 @@ final class EnumTests: XCTestCase { } func testEnum26() { - AssertParse( + assertParse( """ enum ExpressibleByRawTypeNotLiteral : Array { case Ladd, Elliott, Sixteenth, Harrison @@ -486,7 +486,7 @@ final class EnumTests: XCTestCase { } func testEnum27() { - AssertParse( + assertParse( """ enum RawTypeCircularityA : RawTypeCircularityB, ExpressibleByIntegerLiteral { case Morrison, Belmont, Madison, Hawthorne @@ -499,7 +499,7 @@ final class EnumTests: XCTestCase { } func testEnum28() { - AssertParse( + assertParse( """ enum RawTypeCircularityB : RawTypeCircularityA, ExpressibleByIntegerLiteral { case Willamette, Columbia, Sandy, Multnomah @@ -512,7 +512,7 @@ final class EnumTests: XCTestCase { } func testEnum29() { - AssertParse( + assertParse( """ struct ExpressibleByFloatLiteralOnly : ExpressibleByFloatLiteral { init(floatLiteral: Double) {} @@ -526,7 +526,7 @@ final class EnumTests: XCTestCase { } func testEnum30() { - AssertParse( + assertParse( """ enum RawTypeWithIntValues : Int { case Glisan = 17, Hoyt = 219, Irving, Johnson = 97209 @@ -536,7 +536,7 @@ final class EnumTests: XCTestCase { } func testEnum31() { - AssertParse( + assertParse( """ enum RawTypeWithNegativeValues : Int { case Glisan = -17, Hoyt = -219, Irving, Johnson = -97209 @@ -547,7 +547,7 @@ final class EnumTests: XCTestCase { } func testEnum32() { - AssertParse( + assertParse( #""" enum RawTypeWithUnicodeScalarValues : UnicodeScalar { case Kearney = "K" @@ -559,7 +559,7 @@ final class EnumTests: XCTestCase { } func testEnum33() { - AssertParse( + assertParse( #""" enum RawTypeWithCharacterValues : Character { case First = "い" @@ -571,7 +571,7 @@ final class EnumTests: XCTestCase { } func testEnum34() { - AssertParse( + assertParse( #""" enum RawTypeWithCharacterValues_Correct : Character { case First = "😅" // ok @@ -584,7 +584,7 @@ final class EnumTests: XCTestCase { } func testEnum35() { - AssertParse( + assertParse( #""" enum RawTypeWithCharacterValues_Error1 : Character { case First = "abc" @@ -594,7 +594,7 @@ final class EnumTests: XCTestCase { } func testEnum36() { - AssertParse( + assertParse( """ enum RawTypeWithFloatValues : Float { case Northrup = 1.5 @@ -606,7 +606,7 @@ final class EnumTests: XCTestCase { } func testEnum37() { - AssertParse( + assertParse( #""" enum RawTypeWithStringValues : String { case Primrose // okay @@ -619,7 +619,7 @@ final class EnumTests: XCTestCase { } func testEnum38() { - AssertParse( + assertParse( """ enum RawValuesWithoutRawType { case Upshur = 22 @@ -629,7 +629,7 @@ final class EnumTests: XCTestCase { } func testEnum39() { - AssertParse( + assertParse( """ enum RawTypeWithRepeatValues : Int { case Vaughn = 22 @@ -640,7 +640,7 @@ final class EnumTests: XCTestCase { } func testEnum40() { - AssertParse( + assertParse( """ enum RawTypeWithRepeatValues2 : Double { case Vaughn = 22 @@ -651,7 +651,7 @@ final class EnumTests: XCTestCase { } func testEnum41() { - AssertParse( + assertParse( """ enum RawTypeWithRepeatValues3 : Double { // 2^63-1 @@ -663,7 +663,7 @@ final class EnumTests: XCTestCase { } func testEnum42() { - AssertParse( + assertParse( """ enum RawTypeWithRepeatValues4 : Double { // 2^64-1 @@ -675,7 +675,7 @@ final class EnumTests: XCTestCase { } func testEnum43() { - AssertParse( + assertParse( """ enum RawTypeWithRepeatValues5 : Double { // FIXME: should reject. @@ -688,7 +688,7 @@ final class EnumTests: XCTestCase { } func testEnum44() { - AssertParse( + assertParse( """ enum RawTypeWithRepeatValues6 : Double { // FIXME: should reject. @@ -701,7 +701,7 @@ final class EnumTests: XCTestCase { } func testEnum45() { - AssertParse( + assertParse( """ enum RawTypeWithRepeatValues7 : Double { // FIXME: should reject. @@ -714,7 +714,7 @@ final class EnumTests: XCTestCase { } func testEnum46() { - AssertParse( + assertParse( #""" enum RawTypeWithRepeatValues8 : String { case Vaughn = "XYZ" @@ -725,7 +725,7 @@ final class EnumTests: XCTestCase { } func testEnum47() { - AssertParse( + assertParse( """ enum RawTypeWithNonRepeatValues : Double { case SantaClara = 3.7 @@ -738,7 +738,7 @@ final class EnumTests: XCTestCase { } func testEnum48() { - AssertParse( + assertParse( """ enum RawTypeWithRepeatValuesAutoInc : Double { case Vaughn = 22 @@ -750,7 +750,7 @@ final class EnumTests: XCTestCase { } func testEnum49() { - AssertParse( + assertParse( """ enum RawTypeWithRepeatValuesAutoInc2 : Double { case Vaughn = 23 @@ -762,7 +762,7 @@ final class EnumTests: XCTestCase { } func testEnum50() { - AssertParse( + assertParse( """ enum RawTypeWithRepeatValuesAutoInc3 : Double { case Vaughn @@ -774,7 +774,7 @@ final class EnumTests: XCTestCase { } func testEnum51() { - AssertParse( + assertParse( #""" enum RawTypeWithRepeatValuesAutoInc4 : String { case A = "B" @@ -785,7 +785,7 @@ final class EnumTests: XCTestCase { } func testEnum52() { - AssertParse( + assertParse( #""" enum RawTypeWithRepeatValuesAutoInc5 : String { case A @@ -796,7 +796,7 @@ final class EnumTests: XCTestCase { } func testEnum53() { - AssertParse( + assertParse( #""" enum RawTypeWithRepeatValuesAutoInc6 : String { case A @@ -808,7 +808,7 @@ final class EnumTests: XCTestCase { } func testEnum54() { - AssertParse( + assertParse( """ enum NonliteralRawValue : Int { case Yeon = 100 + 20 + 3 @@ -818,7 +818,7 @@ final class EnumTests: XCTestCase { } func testEnum55() { - AssertParse( + assertParse( """ enum RawTypeWithPayload : Int { case Powell(Int) @@ -829,7 +829,7 @@ final class EnumTests: XCTestCase { } func testEnum56() { - AssertParse( + assertParse( #""" enum RawTypeMismatch : Int { case Barbur = "foo" @@ -839,7 +839,7 @@ final class EnumTests: XCTestCase { } func testEnum57() { - AssertParse( + assertParse( """ enum DuplicateMembers1 { case Foo @@ -850,7 +850,7 @@ final class EnumTests: XCTestCase { } func testEnum58() { - AssertParse( + assertParse( """ enum DuplicateMembers2 { case Foo, Bar @@ -862,7 +862,7 @@ final class EnumTests: XCTestCase { } func testEnum59() { - AssertParse( + assertParse( """ enum DuplicateMembers3 { case Foo @@ -873,7 +873,7 @@ final class EnumTests: XCTestCase { } func testEnum60() { - AssertParse( + assertParse( """ enum DuplicateMembers4 : Int { case Foo = 1 @@ -884,7 +884,7 @@ final class EnumTests: XCTestCase { } func testEnum61() { - AssertParse( + assertParse( """ enum DuplicateMembers5 : Int { case Foo = 1 @@ -895,7 +895,7 @@ final class EnumTests: XCTestCase { } func testEnum62() { - AssertParse( + assertParse( """ enum DuplicateMembers6 { case Foo // expected-note 2{{'Foo' previously declared here}} @@ -907,7 +907,7 @@ final class EnumTests: XCTestCase { } func testEnum63() { - AssertParse( + assertParse( #""" enum DuplicateMembers7 : String { case Foo @@ -918,7 +918,7 @@ final class EnumTests: XCTestCase { } func testEnum64() { - AssertParse( + assertParse( #""" // Refs to duplicated enum cases shouldn't crash the compiler. // rdar://problem/20922401 @@ -934,7 +934,7 @@ final class EnumTests: XCTestCase { } func testEnum65() { - AssertParse( + assertParse( """ enum PlaygroundRepresentation : UInt8 { case Class = 1 @@ -962,7 +962,7 @@ final class EnumTests: XCTestCase { } func testEnum66() { - AssertParse( + assertParse( """ struct ManyLiteralable : ExpressibleByIntegerLiteral, ExpressibleByStringLiteral, Equatable { init(stringLiteral: String) {} @@ -976,7 +976,7 @@ final class EnumTests: XCTestCase { } func testEnum67() { - AssertParse( + assertParse( """ enum ManyLiteralA : ManyLiteralable { case A @@ -987,7 +987,7 @@ final class EnumTests: XCTestCase { } func testEnum68() { - AssertParse( + assertParse( #""" enum ManyLiteralB : ManyLiteralable { case A = "abc" @@ -998,7 +998,7 @@ final class EnumTests: XCTestCase { } func testEnum69() { - AssertParse( + assertParse( #""" enum ManyLiteralC : ManyLiteralable { case A @@ -1009,7 +1009,7 @@ final class EnumTests: XCTestCase { } func testEnum70() { - AssertParse( + assertParse( """ // rdar://problem/22476643 public protocol RawValueA: RawRepresentable @@ -1021,7 +1021,7 @@ final class EnumTests: XCTestCase { } func testEnum71() { - AssertParse( + assertParse( """ enum RawValueATest: Double, RawValueA { case A, B @@ -1031,7 +1031,7 @@ final class EnumTests: XCTestCase { } func testEnum72() { - AssertParse( + assertParse( """ public protocol RawValueB { @@ -1042,7 +1042,7 @@ final class EnumTests: XCTestCase { } func testEnum73() { - AssertParse( + assertParse( """ enum RawValueBTest: Double, RawValueB { case A, B @@ -1052,7 +1052,7 @@ final class EnumTests: XCTestCase { } func testEnum74() { - AssertParse( + assertParse( """ enum foo : String { case bar = nil @@ -1062,7 +1062,7 @@ final class EnumTests: XCTestCase { } func testEnum75() { - AssertParse( + assertParse( """ // Static member lookup from instance methods """ @@ -1070,7 +1070,7 @@ final class EnumTests: XCTestCase { } func testEnum76() { - AssertParse( + assertParse( """ struct EmptyStruct {} """ @@ -1078,7 +1078,7 @@ final class EnumTests: XCTestCase { } func testEnum77() { - AssertParse( + assertParse( """ enum EnumWithStaticMember { static let staticVar = EmptyStruct() @@ -1091,7 +1091,7 @@ final class EnumTests: XCTestCase { } func testEnum78() { - AssertParse( + assertParse( """ // SE-0036: """ @@ -1099,7 +1099,7 @@ final class EnumTests: XCTestCase { } func testEnum79() { - AssertParse( + assertParse( """ struct SE0036_Auxiliary {} """ @@ -1107,7 +1107,7 @@ final class EnumTests: XCTestCase { } func testEnum80() { - AssertParse( + assertParse( """ enum SE0036 { case A @@ -1172,7 +1172,7 @@ final class EnumTests: XCTestCase { } func testEnum81() { - AssertParse( + assertParse( """ enum SE0036_Generic { case A(x: T) @@ -1193,7 +1193,7 @@ final class EnumTests: XCTestCase { } func testEnum81b() { - AssertParse( + assertParse( """ switch self { case A(_): break @@ -1203,7 +1203,7 @@ final class EnumTests: XCTestCase { } func testEnum82() { - AssertParse( + assertParse( """ enum 1️⃣switch {} """, @@ -1214,7 +1214,7 @@ final class EnumTests: XCTestCase { } func testEnum83() { - AssertParse( + assertParse( """ enum SE0155 { case emptyArgs() @@ -1224,7 +1224,7 @@ final class EnumTests: XCTestCase { } func testEnum84() { - AssertParse( + assertParse( """ // https://github.com/apple/swift/issues/53662 """ @@ -1232,7 +1232,7 @@ final class EnumTests: XCTestCase { } func testEnum85() { - AssertParse( + assertParse( """ enum E_53662 { case identifier @@ -1247,7 +1247,7 @@ final class EnumTests: XCTestCase { } func testEnum86() { - AssertParse( + assertParse( """ enum E_53662_var { case identifier @@ -1262,7 +1262,7 @@ final class EnumTests: XCTestCase { } func testEnum87() { - AssertParse( + assertParse( """ enum E_53662_underscore { case identifier @@ -1277,7 +1277,7 @@ final class EnumTests: XCTestCase { } func testEnum88() { - AssertParse( + assertParse( """ enum E_53662_Comma { case a, b, c, 1️⃣func, d @@ -1290,7 +1290,7 @@ final class EnumTests: XCTestCase { } func testEnum89() { - AssertParse( + assertParse( """ enum E_53662_Newline { case identifier1 @@ -1306,7 +1306,7 @@ final class EnumTests: XCTestCase { } func testEnum90() { - AssertParse( + assertParse( """ enum E_53662_Newline2 { case 1️⃣ @@ -1320,7 +1320,7 @@ final class EnumTests: XCTestCase { } func testEnum91() { - AssertParse( + assertParse( """ enum E_53662_PatternMatching { case 1️⃣let 2️⃣.foo(x, y): @@ -1334,7 +1334,7 @@ final class EnumTests: XCTestCase { } func testEnum92() { - AssertParse( + assertParse( #""" enum CasesWithMissingElement: Int { case a = "hello", 1️⃣ diff --git a/Tests/SwiftParserTest/translated/ErrorsTests.swift b/Tests/SwiftParserTest/translated/ErrorsTests.swift index 4c65638c94b..40a8c35ca14 100644 --- a/Tests/SwiftParserTest/translated/ErrorsTests.swift +++ b/Tests/SwiftParserTest/translated/ErrorsTests.swift @@ -18,7 +18,7 @@ import XCTest final class ErrorsTests: XCTestCase { func testErrors1() { - AssertParse( + assertParse( #""" enum MSV : Error { case Foo, Bar, Baz @@ -31,7 +31,7 @@ final class ErrorsTests: XCTestCase { } func testErrors2() { - AssertParse( + assertParse( """ func opaque_error() -> Error { return MSV.Foo } """ @@ -39,7 +39,7 @@ final class ErrorsTests: XCTestCase { } func testErrors3() { - AssertParse( + assertParse( """ func one() { do { @@ -92,7 +92,7 @@ final class ErrorsTests: XCTestCase { } func testErrors4() { - AssertParse( + assertParse( """ func takesAutoclosure(_ fn : @autoclosure () -> Int) {} func takesThrowingAutoclosure(_ fn : @autoclosure () throws -> Int) {} @@ -101,7 +101,7 @@ final class ErrorsTests: XCTestCase { } func testErrors5() { - AssertParse( + assertParse( """ func genError() throws -> Int { throw MSV.Foo } func genNoError() -> Int { return 0 } @@ -110,7 +110,7 @@ final class ErrorsTests: XCTestCase { } func testErrors6() { - AssertParse( + assertParse( """ func testAutoclosures() throws { takesAutoclosure(genError()) @@ -131,7 +131,7 @@ final class ErrorsTests: XCTestCase { } func testErrors7() { - AssertParse( + assertParse( """ func illformed() throws { do { @@ -147,7 +147,7 @@ final class ErrorsTests: XCTestCase { } func testErrors8() { - AssertParse( + assertParse( """ func postThrows() -> Int 1️⃣throws { return 5 @@ -165,7 +165,7 @@ final class ErrorsTests: XCTestCase { } func testErrors9() { - AssertParse( + assertParse( """ func postThrows2() -> 1️⃣throws Int { return try postThrows() @@ -178,7 +178,7 @@ final class ErrorsTests: XCTestCase { } func testErrors10() { - AssertParse( + assertParse( """ func postRethrows(_ f: () throws -> Int) -> Int 1️⃣rethrows { return try f() @@ -196,7 +196,7 @@ final class ErrorsTests: XCTestCase { } func testErrors11() { - AssertParse( + assertParse( """ func postRethrows2(_ f: () throws -> Int) -> 1️⃣rethrows Int { return try f() @@ -209,7 +209,7 @@ final class ErrorsTests: XCTestCase { } func testErrors12() { - AssertParse( + assertParse( """ func postThrows3() { _ = { () -> Int 1️⃣throws in } @@ -222,7 +222,7 @@ final class ErrorsTests: XCTestCase { } func testErrors13() { - AssertParse( + assertParse( """ func dupThrows1() throws 1️⃣rethrows -> 2️⃣throws Int 3️⃣throw {} """, @@ -238,7 +238,7 @@ final class ErrorsTests: XCTestCase { } func testErrors14() { - AssertParse( + assertParse( """ func dupThrows2(_ f: () throws -> 1️⃣rethrows Int) {} """, @@ -252,7 +252,7 @@ final class ErrorsTests: XCTestCase { } func testErrors15a() { - AssertParse( + assertParse( """ _ = { () 1️⃣try throws in } """, @@ -266,7 +266,7 @@ final class ErrorsTests: XCTestCase { } func testErrors15b() { - AssertParse( + assertParse( """ _ = { () throws -> Int 1️⃣throws in } """, @@ -280,7 +280,7 @@ final class ErrorsTests: XCTestCase { } func testErrors16() { - AssertParse( + assertParse( """ func incompleteThrowType() { let _: () 1️⃣throws @@ -316,7 +316,7 @@ final class ErrorsTests: XCTestCase { func testErrors17a() { // rdar://21328447 - AssertParse( + assertParse( """ func fixitThrow0() 1️⃣throw {} """, @@ -330,7 +330,7 @@ final class ErrorsTests: XCTestCase { } func testErrors17b() { - AssertParse( + assertParse( """ func fixitThrow1() 1️⃣throw -> Int {} """, @@ -344,7 +344,7 @@ final class ErrorsTests: XCTestCase { } func testErrors17c() { - AssertParse( + assertParse( """ func fixitThrow2() throws { var _: (Int) @@ -366,7 +366,7 @@ final class ErrorsTests: XCTestCase { } func testErrors18() { - AssertParse( + assertParse( """ let fn: () -> 1️⃣throws Void """, @@ -380,7 +380,7 @@ final class ErrorsTests: XCTestCase { } func testErrors19() { - AssertParse( + assertParse( """ // https://github.com/apple/swift/issues/53979 """ @@ -388,7 +388,7 @@ final class ErrorsTests: XCTestCase { } func testErrors20() { - AssertParse( + assertParse( """ func fixitTry0(a: T) 1️⃣try where T:ExpressibleByStringLiteral {} """, @@ -399,7 +399,7 @@ final class ErrorsTests: XCTestCase { } func testErrors21() { - AssertParse( + assertParse( """ func fixitTry1(a: T) 1️⃣try {} """, @@ -413,7 +413,7 @@ final class ErrorsTests: XCTestCase { } func testErrors22() { - AssertParse( + assertParse( """ func fixitTry2() 1️⃣try {} """, @@ -424,7 +424,7 @@ final class ErrorsTests: XCTestCase { } func testErrors23() { - AssertParse( + assertParse( """ let fixitTry3 : () 1️⃣try -> Int """, @@ -435,7 +435,7 @@ final class ErrorsTests: XCTestCase { } func testErrors24() { - AssertParse( + assertParse( """ func fixitAwait0() 1️⃣await { } """, @@ -449,7 +449,7 @@ final class ErrorsTests: XCTestCase { } func testErrors25() { - AssertParse( + assertParse( """ func fixitAwait1() 1️⃣await -> Int { } """, @@ -463,7 +463,7 @@ final class ErrorsTests: XCTestCase { } func testErrors26() { - AssertParse( + assertParse( """ func fixitAwait2() throws 1️⃣await -> Int { } """, @@ -477,7 +477,7 @@ final class ErrorsTests: XCTestCase { } func testAwaitBetwenAsyncAndThrows() { - AssertParse( + assertParse( """ func fixitAwait2() async 1️⃣await throws -> Int { } """, @@ -491,7 +491,7 @@ final class ErrorsTests: XCTestCase { } func testAsyncAwait() { - AssertParse( + assertParse( """ func fixitAwait2() async 1️⃣await -> Int { } """, diff --git a/Tests/SwiftParserTest/translated/EscapedIdentifiersTests.swift b/Tests/SwiftParserTest/translated/EscapedIdentifiersTests.swift index 60edcd4e211..69eabfbf489 100644 --- a/Tests/SwiftParserTest/translated/EscapedIdentifiersTests.swift +++ b/Tests/SwiftParserTest/translated/EscapedIdentifiersTests.swift @@ -16,7 +16,7 @@ import XCTest final class EscapedIdentifiersTests: XCTestCase { func testEscapedIdentifiers1() { - AssertParse( + assertParse( """ func `protocol`() {} """ @@ -24,7 +24,7 @@ final class EscapedIdentifiersTests: XCTestCase { } func testEscapedIdentifiers2() { - AssertParse( + assertParse( """ `protocol`() """ @@ -32,7 +32,7 @@ final class EscapedIdentifiersTests: XCTestCase { } func testEscapedIdentifiers3() { - AssertParse( + assertParse( """ class `Type` {} """ @@ -40,7 +40,7 @@ final class EscapedIdentifiersTests: XCTestCase { } func testEscapedIdentifiers4() { - AssertParse( + assertParse( """ var `class` = `Type`.self """ @@ -48,7 +48,7 @@ final class EscapedIdentifiersTests: XCTestCase { } func testEscapedIdentifiers5() { - AssertParse( + assertParse( """ func foo() {} """ @@ -56,7 +56,7 @@ final class EscapedIdentifiersTests: XCTestCase { } func testEscapedIdentifiers6() { - AssertParse( + assertParse( """ `foo`() """ @@ -64,7 +64,7 @@ final class EscapedIdentifiersTests: XCTestCase { } func testEscapedIdentifiers7() { - AssertParse( + assertParse( """ // Escaping suppresses identifier contextualization. var get: (() -> ()) -> () = { $0() } @@ -73,7 +73,7 @@ final class EscapedIdentifiersTests: XCTestCase { } func testEscapedIdentifiers8() { - AssertParse( + assertParse( """ var applyGet: Int { `get` { } @@ -84,7 +84,7 @@ final class EscapedIdentifiersTests: XCTestCase { } func testEscapedIdentifiers9() { - AssertParse( + assertParse( """ enum `switch` {} """ @@ -92,7 +92,7 @@ final class EscapedIdentifiersTests: XCTestCase { } func testEscapedIdentifiers10() { - AssertParse( + assertParse( """ typealias `Self` = Int """ diff --git a/Tests/SwiftParserTest/translated/ForeachAsyncTests.swift b/Tests/SwiftParserTest/translated/ForeachAsyncTests.swift index 85bb922821d..cc618cf5476 100644 --- a/Tests/SwiftParserTest/translated/ForeachAsyncTests.swift +++ b/Tests/SwiftParserTest/translated/ForeachAsyncTests.swift @@ -16,7 +16,7 @@ import XCTest final class ForeachAsyncTests: XCTestCase { func testForeachAsync1() { - AssertParse( + assertParse( """ import _Concurrency """ @@ -24,7 +24,7 @@ final class ForeachAsyncTests: XCTestCase { } func testForeachAsync2() { - AssertParse( + assertParse( """ struct AsyncRange: AsyncSequence, AsyncIteratorProtocol where Bound.Stride : SignedInteger { var range: Range.Iterator @@ -38,7 +38,7 @@ final class ForeachAsyncTests: XCTestCase { } func testForeachAsync3() { - AssertParse( + assertParse( """ struct AsyncIntRange : AsyncSequence, AsyncIteratorProtocol { typealias Element = (Int, Int) @@ -52,7 +52,7 @@ final class ForeachAsyncTests: XCTestCase { } func testForeachAsync4() { - AssertParse( + assertParse( """ func for_each(r: AsyncRange, iir: AsyncIntRange) async { var sum = 0 diff --git a/Tests/SwiftParserTest/translated/ForeachTests.swift b/Tests/SwiftParserTest/translated/ForeachTests.swift index 93a82ce98bb..a49e627f74a 100644 --- a/Tests/SwiftParserTest/translated/ForeachTests.swift +++ b/Tests/SwiftParserTest/translated/ForeachTests.swift @@ -16,7 +16,7 @@ import XCTest final class ForeachTests: XCTestCase { func testForeach1() { - AssertParse( + assertParse( """ struct IntRange : Sequence, IteratorProtocol { typealias Element = (Int, Int) @@ -29,7 +29,7 @@ final class ForeachTests: XCTestCase { } func testForeach2() { - AssertParse( + assertParse( """ func for_each(r: Range, iir: IntRange) { var sum = 0 diff --git a/Tests/SwiftParserTest/translated/GenericDisambiguationTests.swift b/Tests/SwiftParserTest/translated/GenericDisambiguationTests.swift index ed5878496e9..d93ea1b993d 100644 --- a/Tests/SwiftParserTest/translated/GenericDisambiguationTests.swift +++ b/Tests/SwiftParserTest/translated/GenericDisambiguationTests.swift @@ -18,7 +18,7 @@ import XCTest final class GenericDisambiguationTests: XCTestCase { func testGenericDisambiguation1() { - AssertParse( + assertParse( """ struct A { init(x:Int) {} @@ -35,7 +35,7 @@ final class GenericDisambiguationTests: XCTestCase { } func testGenericDisambiguation2() { - AssertParse( + assertParse( """ protocol Runcible {} protocol Fungible {} @@ -44,7 +44,7 @@ final class GenericDisambiguationTests: XCTestCase { } func testGenericDisambiguation3() { - AssertParse( + assertParse( """ func meta(_ m: T.Type) {} func meta2(_ m: T.Type, _ x: Int) {} @@ -53,7 +53,7 @@ final class GenericDisambiguationTests: XCTestCase { } func testGenericDisambiguation4() { - AssertParse( + assertParse( """ func generic(_ x: T) {} """ @@ -61,7 +61,7 @@ final class GenericDisambiguationTests: XCTestCase { } func testGenericDisambiguation5() { - AssertParse( + assertParse( """ var a, b, c, d : Int """ @@ -69,7 +69,7 @@ final class GenericDisambiguationTests: XCTestCase { } func testGenericDisambiguation6a() { - AssertParse( + assertParse( """ _ = a < b """ @@ -77,7 +77,7 @@ final class GenericDisambiguationTests: XCTestCase { } func testGenericDisambiguation6b() { - AssertParse( + assertParse( """ _ = (a < b, c > d) """ @@ -86,7 +86,7 @@ final class GenericDisambiguationTests: XCTestCase { func testGenericDisambiguation6c() { // Parses as generic because of lparen after '>' - AssertParse( + assertParse( """ (a < b, c > (d)) """, @@ -106,7 +106,7 @@ final class GenericDisambiguationTests: XCTestCase { func testGenericDisambiguation6d() { // Parses as generic because of lparen after '>' - AssertParse( + assertParse( """ (a(d)) """, @@ -125,7 +125,7 @@ final class GenericDisambiguationTests: XCTestCase { } func testGenericDisambiguation6e() { - AssertParse( + assertParse( """ _ = a>(b) """ @@ -133,7 +133,7 @@ final class GenericDisambiguationTests: XCTestCase { } func testGenericDisambiguation6f() { - AssertParse( + assertParse( """ _ = a > (b) """ @@ -141,7 +141,7 @@ final class GenericDisambiguationTests: XCTestCase { } func testGenericDisambiguation7() { - AssertParse( + assertParse( """ generic(0) """ @@ -149,7 +149,7 @@ final class GenericDisambiguationTests: XCTestCase { } func testGenericDisambiguation8() { - AssertParse( + assertParse( """ A.c() A>.c() @@ -169,7 +169,7 @@ final class GenericDisambiguationTests: XCTestCase { } func testGenericDisambiguation9() { - AssertParse( + assertParse( """ A(x: 0) """ @@ -177,7 +177,7 @@ final class GenericDisambiguationTests: XCTestCase { } func testGenericDisambiguation10() { - AssertParse( + assertParse( """ meta(A.self) """ @@ -185,7 +185,7 @@ final class GenericDisambiguationTests: XCTestCase { } func testGenericDisambiguation11() { - AssertParse( + assertParse( """ meta2(A.self, 0) """ @@ -193,7 +193,7 @@ final class GenericDisambiguationTests: XCTestCase { } func testGenericDisambiguation12() { - AssertParse( + assertParse( """ // FIXME: Nested generic types. Need to be able to express $T0 in the // typechecker. @@ -204,7 +204,7 @@ final class GenericDisambiguationTests: XCTestCase { } func testGenericDisambiguation13() { - AssertParse( + assertParse( """ A.C(0) """ @@ -212,7 +212,7 @@ final class GenericDisambiguationTests: XCTestCase { } func testGenericDisambiguation14() { - AssertParse( + assertParse( """ meta(A.C.self) meta2(A.C.self, 0) @@ -226,7 +226,7 @@ final class GenericDisambiguationTests: XCTestCase { func testGenericDisambiguation15() { // TODO: parse empty <> list - AssertParse( + assertParse( """ A<>.c() """ @@ -234,7 +234,7 @@ final class GenericDisambiguationTests: XCTestCase { } func testGenericDisambiguation16() { - AssertParse( + assertParse( """ A.c() """ @@ -242,7 +242,7 @@ final class GenericDisambiguationTests: XCTestCase { } func testGenericDisambiguation17() { - AssertParse( + assertParse( """ A(x: 0) // parses as type _ = a < b ? c : d @@ -251,7 +251,7 @@ final class GenericDisambiguationTests: XCTestCase { } func testGenericDisambiguation18() { - AssertParse( + assertParse( """ A<(B) throws -> D>(x: 0) """ diff --git a/Tests/SwiftParserTest/translated/GuardTests.swift b/Tests/SwiftParserTest/translated/GuardTests.swift index d849e43bada..937b6977e37 100644 --- a/Tests/SwiftParserTest/translated/GuardTests.swift +++ b/Tests/SwiftParserTest/translated/GuardTests.swift @@ -16,7 +16,7 @@ import XCTest final class GuardTests: XCTestCase { func testGuard1() { - AssertParse( + assertParse( """ func noConditionNoElse() { guard {} 1️⃣ @@ -29,7 +29,7 @@ final class GuardTests: XCTestCase { } func testGuard2() { - AssertParse( + assertParse( """ func noCondition() { guard 1️⃣else {} diff --git a/Tests/SwiftParserTest/translated/GuardTopLevelTests.swift b/Tests/SwiftParserTest/translated/GuardTopLevelTests.swift index e59a0bc2fce..f4134764a43 100644 --- a/Tests/SwiftParserTest/translated/GuardTopLevelTests.swift +++ b/Tests/SwiftParserTest/translated/GuardTopLevelTests.swift @@ -16,7 +16,7 @@ import XCTest final class GuardTopLevelTests: XCTestCase { func testGuardTopLevel1() { - AssertParse( + assertParse( """ let a: Int? = 1 guard let b = a else { @@ -26,7 +26,7 @@ final class GuardTopLevelTests: XCTestCase { } func testGuardTopLevel2() { - AssertParse( + assertParse( """ func foo() {} // to interrupt the TopLevelCodeDecl """ @@ -34,7 +34,7 @@ final class GuardTopLevelTests: XCTestCase { } func testGuardTopLevel3() { - AssertParse( + assertParse( """ let c = b """ diff --git a/Tests/SwiftParserTest/translated/HashbangLibraryTests.swift b/Tests/SwiftParserTest/translated/HashbangLibraryTests.swift index 562ebac8c96..bc36539b993 100644 --- a/Tests/SwiftParserTest/translated/HashbangLibraryTests.swift +++ b/Tests/SwiftParserTest/translated/HashbangLibraryTests.swift @@ -20,7 +20,7 @@ final class HashbangLibraryTests: XCTestCase { func testHashbangLibrary1() { // Check that we diagnose and skip the hashbang at the beginning of the file // when compiling in library mode. - AssertParse( + assertParse( """ #!/usr/bin/swift class Foo {} diff --git a/Tests/SwiftParserTest/translated/HashbangMainTests.swift b/Tests/SwiftParserTest/translated/HashbangMainTests.swift index 90ac0a6c399..45d8c64ed1b 100644 --- a/Tests/SwiftParserTest/translated/HashbangMainTests.swift +++ b/Tests/SwiftParserTest/translated/HashbangMainTests.swift @@ -16,7 +16,7 @@ import XCTest final class HashbangMainTests: XCTestCase { func testHashbangMain1() { - AssertParse( + assertParse( """ #!/usr/bin/swift let x = 42 diff --git a/Tests/SwiftParserTest/translated/IdentifiersTests.swift b/Tests/SwiftParserTest/translated/IdentifiersTests.swift index cf5eaf88386..499a4751f62 100644 --- a/Tests/SwiftParserTest/translated/IdentifiersTests.swift +++ b/Tests/SwiftParserTest/translated/IdentifiersTests.swift @@ -16,7 +16,7 @@ import XCTest final class IdentifiersTests: XCTestCase { func testIdentifiers1() { - AssertParse( + assertParse( """ func my_print(_ t: T) {} """ @@ -24,7 +24,7 @@ final class IdentifiersTests: XCTestCase { } func testIdentifiers2() { - AssertParse( + assertParse( #""" class 你好 { class שלום { @@ -42,7 +42,7 @@ final class IdentifiersTests: XCTestCase { } func testIdentifiers3() { - AssertParse( + assertParse( """ 你好.שלום.வணக்கம்.Γειά.привет() """ @@ -50,7 +50,7 @@ final class IdentifiersTests: XCTestCase { } func testIdentifiers4() { - AssertParse( + assertParse( """ // Identifiers cannot start with combining chars. _ = .́duh() @@ -59,7 +59,7 @@ final class IdentifiersTests: XCTestCase { } func testIdentifiers5() { - AssertParse( + assertParse( """ // Combining characters can be used within identifiers. func s̈pin̈al_tap̈() {} @@ -69,7 +69,7 @@ final class IdentifiersTests: XCTestCase { func testIdentifiers6() { // Private-use characters aren't valid in Swift source. - AssertParse( + assertParse( """ 1️⃣() """, @@ -80,7 +80,7 @@ final class IdentifiersTests: XCTestCase { } func testIdentifiers7() { - AssertParse( + assertParse( """ // Placeholders are recognized as identifiers but with error. func <#some name#>() {} @@ -92,7 +92,7 @@ final class IdentifiersTests: XCTestCase { } func testIdentifiers8a() { - AssertParse( + assertParse( """ // Keywords as identifiers class 1️⃣switch {} @@ -108,7 +108,7 @@ final class IdentifiersTests: XCTestCase { } func testIdentifiers8b() { - AssertParse( + assertParse( """ struct 1️⃣Self {} """, @@ -119,7 +119,7 @@ final class IdentifiersTests: XCTestCase { } func testStructNamedLowercaseAny() { - AssertParse( + assertParse( """ struct any {} """ @@ -127,7 +127,7 @@ final class IdentifiersTests: XCTestCase { } func testStructNamedCapitalAny() { - AssertParse( + assertParse( """ struct 1️⃣Any {} """, @@ -138,7 +138,7 @@ final class IdentifiersTests: XCTestCase { } func testIdentifiers8c() { - AssertParse( + assertParse( """ protocol 1️⃣enum {} """, @@ -149,7 +149,7 @@ final class IdentifiersTests: XCTestCase { } func testIdentifiers8d() { - AssertParse( + assertParse( """ protocol test { associatedtype 1️⃣public @@ -164,7 +164,7 @@ final class IdentifiersTests: XCTestCase { } func testIdentifiers9() { - AssertParse( + assertParse( """ // SIL keywords are tokenized as normal identifiers in non-SIL mode. _ = undef @@ -181,7 +181,7 @@ final class IdentifiersTests: XCTestCase { } func testIdentifiers10() { - AssertParse( + assertParse( """ // https://github.com/apple/swift/issues/57542 // Make sure we do not parse the '_' on the newline as being part of the 'variable' identifier on the line before. @@ -190,7 +190,7 @@ final class IdentifiersTests: XCTestCase { } func testIdentifiers11() { - AssertParse( + assertParse( """ @propertyWrapper struct Wrapper { @@ -201,7 +201,7 @@ final class IdentifiersTests: XCTestCase { } func testIdentifiers12() { - AssertParse( + assertParse( """ func localScope() { @Wrapper var variable diff --git a/Tests/SwiftParserTest/translated/IfconfigExprTests.swift b/Tests/SwiftParserTest/translated/IfconfigExprTests.swift index ede35e82f83..b6ca20488e7 100644 --- a/Tests/SwiftParserTest/translated/IfconfigExprTests.swift +++ b/Tests/SwiftParserTest/translated/IfconfigExprTests.swift @@ -17,7 +17,7 @@ import SwiftSyntax final class IfconfigExprTests: XCTestCase { func testIfconfigExpr1() { - AssertParse( + assertParse( """ postfix operator ++ postfix func ++ (_: Int) -> Int { 0 } @@ -26,7 +26,7 @@ final class IfconfigExprTests: XCTestCase { } func testIfconfigExpr2() { - AssertParse( + assertParse( """ struct OneResult {} struct TwoResult {} @@ -35,7 +35,7 @@ final class IfconfigExprTests: XCTestCase { } func testIfconfigExpr3() { - AssertParse( + assertParse( """ protocol MyProto { func optionalMethod() -> [Int]? @@ -50,7 +50,7 @@ final class IfconfigExprTests: XCTestCase { } func testIfconfigExpr4() { - AssertParse( + assertParse( """ func globalFunc(_ arg: T) -> T { arg } """ @@ -58,7 +58,7 @@ final class IfconfigExprTests: XCTestCase { } func testIfconfigExpr5() { - AssertParse( + assertParse( """ func testBasic(baseExpr: MyStruct) { baseExpr @@ -73,7 +73,7 @@ final class IfconfigExprTests: XCTestCase { } func testIfconfigExpr6() { - AssertParse( + assertParse( """ MyStruct() #if CONDITION_1 @@ -86,7 +86,7 @@ final class IfconfigExprTests: XCTestCase { } func testIfconfigExpr7() { - AssertParse( + assertParse( #""" func testInvalidContent(baseExpr: MyStruct, otherExpr: Int) { baseExpr @@ -112,7 +112,7 @@ final class IfconfigExprTests: XCTestCase { } func testIfconfigExpr8() { - AssertParse( + assertParse( """ func testExprKind(baseExpr: MyStruct, idx: Int) { baseExpr @@ -136,7 +136,7 @@ final class IfconfigExprTests: XCTestCase { } func testIfconfigExpr9() { - AssertParse( + assertParse( """ func emptyElse(baseExpr: MyStruct) { baseExpr @@ -160,7 +160,7 @@ final class IfconfigExprTests: XCTestCase { } func testIfconfigExpr10() { - AssertParse( + assertParse( """ func consecutiveIfConfig(baseExpr: MyStruct) { baseExpr @@ -177,7 +177,7 @@ final class IfconfigExprTests: XCTestCase { } func testIfconfigExpr11() { - AssertParse( + assertParse( """ func nestedIfConfig(baseExpr: MyStruct) { baseExpr @@ -200,7 +200,7 @@ final class IfconfigExprTests: XCTestCase { } func testIfconfigExpr12() { - AssertParse( + assertParse( """ func ifconfigExprInExpr(baseExpr: MyStruct) { globalFunc( @@ -217,7 +217,7 @@ final class IfconfigExprTests: XCTestCase { } func testIfconfigExpr13() { - AssertParse( + assertParse( """ #if canImport(A, _version: 2) let a = 1 @@ -227,7 +227,7 @@ final class IfconfigExprTests: XCTestCase { } func testIfconfigExpr14() { - AssertParse( + assertParse( """ #if canImport(A, _version: 2.2) let a = 1 @@ -237,7 +237,7 @@ final class IfconfigExprTests: XCTestCase { } func testIfconfigExpr15() { - AssertParse( + assertParse( """ #if canImport(A, _version: 2.2.2) let a = 1 @@ -247,7 +247,7 @@ final class IfconfigExprTests: XCTestCase { } func testIfconfigExpr16() { - AssertParse( + assertParse( """ #if canImport(A, _version: 2.2.2.2) let a = 1 @@ -257,7 +257,7 @@ final class IfconfigExprTests: XCTestCase { } func testIfconfigExpr17() { - AssertParse( + assertParse( """ #if canImport(A, _version: 2.2.2.2.2) let a = 1 @@ -270,7 +270,7 @@ final class IfconfigExprTests: XCTestCase { } func testIfconfigExpr18() { - AssertParse( + assertParse( """ #if canImport(A, _underlyingVersion: 4) let a = 1 @@ -280,7 +280,7 @@ final class IfconfigExprTests: XCTestCase { } func testIfconfigExpr19() { - AssertParse( + assertParse( """ #if canImport(A, _underlyingVersion: 2.200) let a = 1 @@ -290,7 +290,7 @@ final class IfconfigExprTests: XCTestCase { } func testIfconfigExpr20() { - AssertParse( + assertParse( """ #if canImport(A, _underlyingVersion: 2.200.1) let a = 1 @@ -300,7 +300,7 @@ final class IfconfigExprTests: XCTestCase { } func testIfconfigExpr21() { - AssertParse( + assertParse( """ #if canImport(A, _underlyingVersion: 2.200.1.3) let a = 1 @@ -310,7 +310,7 @@ final class IfconfigExprTests: XCTestCase { } func testIfconfigExpr22() { - AssertParse( + assertParse( """ #if canImport(A, unknown: 2.2) let a = 1 @@ -323,7 +323,7 @@ final class IfconfigExprTests: XCTestCase { } func testIfconfigExpr23() { - AssertParse( + assertParse( """ #if canImport(A,1️⃣) let a = 1 @@ -336,7 +336,7 @@ final class IfconfigExprTests: XCTestCase { } func testIfconfigExpr24() { - AssertParse( + assertParse( """ #if canImport(A, 2.2) let a = 1 @@ -349,7 +349,7 @@ final class IfconfigExprTests: XCTestCase { } func testIfconfigExpr25() { - AssertParse( + assertParse( """ #if canImport(A, 2.2, 1.1) let a = 1 @@ -362,7 +362,7 @@ final class IfconfigExprTests: XCTestCase { } func testIfconfigExpr26() { - AssertParse( + assertParse( """ #if canImport(A, _version:1️⃣) let a = 1 @@ -375,7 +375,7 @@ final class IfconfigExprTests: XCTestCase { } func testIfconfigExpr27() { - AssertParse( + assertParse( #""" #if canImport(A, _version: "") let a = 1 @@ -388,7 +388,7 @@ final class IfconfigExprTests: XCTestCase { } func testIfconfigExpr28() { - AssertParse( + assertParse( """ #if canImport(A, _version: >=2.2) let a = 1 @@ -401,7 +401,7 @@ final class IfconfigExprTests: XCTestCase { } func testIfconfigExpr29() { - AssertParse( + assertParse( """ #if canImport(A, _version: 201️⃣A301) let a = 1 @@ -414,7 +414,7 @@ final class IfconfigExprTests: XCTestCase { } func testIfconfigExpr30() { - AssertParse( + assertParse( #""" #if canImport(A, _version: "20A301") let a = 1 @@ -427,7 +427,7 @@ final class IfconfigExprTests: XCTestCase { } func testIfconfigExpr31() { - AssertParse( + assertParse( """ #if arch(x86_64) debugPrint("x86_64") @@ -456,7 +456,7 @@ final class IfconfigExprTests: XCTestCase { } func testUnknownPlatform1() { - AssertParse( + assertParse( """ #if hasGreeble(blah) #endif @@ -465,7 +465,7 @@ final class IfconfigExprTests: XCTestCase { } func testUnknownPlatform2() { - AssertParse( + assertParse( """ // Future compiler, short-circuit right-hand side #if compiler(>=10.0) && hasGreeble(blah) @@ -475,7 +475,7 @@ final class IfconfigExprTests: XCTestCase { } func testUnknownPlatform3() { - AssertParse( + assertParse( """ // Current compiler, short-circuit right-hand side #if compiler(<10.0) || hasGreeble(blah) @@ -500,7 +500,7 @@ final class IfconfigExprTests: XCTestCase { } func testUnknownPlatform4() { - AssertParse( + assertParse( """ // This compiler, don't short-circuit. #if compiler(>=5.7) && hasGreeble(blah) @@ -510,7 +510,7 @@ final class IfconfigExprTests: XCTestCase { } func testUnknownPlatform5() { - AssertParse( + assertParse( """ // This compiler, don't short-circuit. #if compiler(<5.8) || hasGreeble(blah) @@ -520,7 +520,7 @@ final class IfconfigExprTests: XCTestCase { } func testUnknownPlatform6() { - AssertParse( + assertParse( #""" // Not a "version" check, so don't short-circuit. #if os(macOS) && hasGreeble(blah) @@ -530,7 +530,7 @@ final class IfconfigExprTests: XCTestCase { } func testUpcomingFeature1() { - AssertParse( + assertParse( """ #if hasFeature(17) #endif diff --git a/Tests/SwiftParserTest/translated/ImplicitGetterIncompleteTests.swift b/Tests/SwiftParserTest/translated/ImplicitGetterIncompleteTests.swift index 7b38f0672bb..0becd842e73 100644 --- a/Tests/SwiftParserTest/translated/ImplicitGetterIncompleteTests.swift +++ b/Tests/SwiftParserTest/translated/ImplicitGetterIncompleteTests.swift @@ -16,7 +16,7 @@ import XCTest final class ImplicitGetterIncompleteTests: XCTestCase { func testImplicitGetterIncomplete1() { - AssertParse( + assertParse( """ func test1() { var a : Int { @@ -32,7 +32,7 @@ final class ImplicitGetterIncompleteTests: XCTestCase { } func testImplicitGetterIncomplete2() { - AssertParse( + assertParse( #""" // Would trigger assertion when AST verifier checks source ranges ("child source range not contained within its parent") func test2() { diff --git a/Tests/SwiftParserTest/translated/InitDeinitTests.swift b/Tests/SwiftParserTest/translated/InitDeinitTests.swift index 5d23185bc3c..8e99acfc563 100644 --- a/Tests/SwiftParserTest/translated/InitDeinitTests.swift +++ b/Tests/SwiftParserTest/translated/InitDeinitTests.swift @@ -18,7 +18,7 @@ import XCTest final class InitDeinitTests: XCTestCase { func testInitDeinit1() { - AssertParse( + assertParse( """ struct FooStructConstructorA { init 1️⃣ @@ -31,7 +31,7 @@ final class InitDeinitTests: XCTestCase { } func testInitDeinit2() { - AssertParse( + assertParse( """ struct FooStructConstructorB { init() @@ -41,7 +41,7 @@ final class InitDeinitTests: XCTestCase { } func testInitDeinit3a() { - AssertParse( + assertParse( """ struct FooStructConstructorC { init 1️⃣{} @@ -54,7 +54,7 @@ final class InitDeinitTests: XCTestCase { } func testInitDeinit3b() { - AssertParse( + assertParse( """ struct FooStructConstructorC { init 1️⃣{} @@ -67,7 +67,7 @@ final class InitDeinitTests: XCTestCase { } func testInitDeinit3c() { - AssertParse( + assertParse( """ struct FooStructConstructorC { init? 1️⃣{ self.init() } @@ -80,7 +80,7 @@ final class InitDeinitTests: XCTestCase { } func testInitDeinit4() { - AssertParse( + assertParse( """ struct FooStructConstructorD { init() 1️⃣-> FooStructConstructorD { } @@ -93,7 +93,7 @@ final class InitDeinitTests: XCTestCase { } func testInitDeinit5a() { - AssertParse( + assertParse( """ struct FooStructDeinitializerA { deinit @@ -103,7 +103,7 @@ final class InitDeinitTests: XCTestCase { } func testInitDeinit5b() { - AssertParse( + assertParse( """ struct FooStructDeinitializerA { deinit 1️⃣x @@ -121,7 +121,7 @@ final class InitDeinitTests: XCTestCase { } func testInitDeinit5c() { - AssertParse( + assertParse( """ struct FooStructDeinitializerA { deinit 1️⃣x2️⃣() @@ -140,7 +140,7 @@ final class InitDeinitTests: XCTestCase { } func testInitDeinit6() { - AssertParse( + assertParse( """ struct FooStructDeinitializerB { deinit @@ -150,7 +150,7 @@ final class InitDeinitTests: XCTestCase { } func testInitDeinit7() { - AssertParse( + assertParse( """ struct FooStructDeinitializerC { deinit {} @@ -160,7 +160,7 @@ final class InitDeinitTests: XCTestCase { } func testInitDeinit8() { - AssertParse( + assertParse( """ class FooClassDeinitializerA { deinit1️⃣(a : Int) {} @@ -178,7 +178,7 @@ final class InitDeinitTests: XCTestCase { } func testInitDeinit9() { - AssertParse( + assertParse( """ class FooClassDeinitializerB { deinit { } @@ -188,7 +188,7 @@ final class InitDeinitTests: XCTestCase { } func testInitDeinit10() { - AssertParse( + assertParse( """ class FooClassDeinitializerC { deinit 1️⃣x 2️⃣(a : Int) {} @@ -207,7 +207,7 @@ final class InitDeinitTests: XCTestCase { } func testInitDeinit11() { - AssertParse( + assertParse( """ init 1️⃣{} init() @@ -220,7 +220,7 @@ final class InitDeinitTests: XCTestCase { } func testInitDeinit12() { - AssertParse( + assertParse( """ deinit {} deinit @@ -230,7 +230,7 @@ final class InitDeinitTests: XCTestCase { } func testInitDeinit13() { - AssertParse( + assertParse( """ struct BarStruct { init() {} @@ -241,7 +241,7 @@ final class InitDeinitTests: XCTestCase { } func testInitDeinit14() { - AssertParse( + assertParse( """ extension BarStruct { init(x : Int) {} @@ -253,7 +253,7 @@ final class InitDeinitTests: XCTestCase { } func testInitDeinit15() { - AssertParse( + assertParse( """ enum BarUnion { init() {} @@ -264,7 +264,7 @@ final class InitDeinitTests: XCTestCase { } func testInitDeinit16() { - AssertParse( + assertParse( """ extension BarUnion { init(x : Int) {} @@ -275,7 +275,7 @@ final class InitDeinitTests: XCTestCase { } func testInitDeinit17() { - AssertParse( + assertParse( """ class BarClass { init() {} @@ -286,7 +286,7 @@ final class InitDeinitTests: XCTestCase { } func testInitDeinit18() { - AssertParse( + assertParse( """ extension BarClass { convenience init(x : Int) { self.init() } @@ -297,7 +297,7 @@ final class InitDeinitTests: XCTestCase { } func testInitDeinit19() { - AssertParse( + assertParse( """ protocol BarProtocol { init() {} @@ -308,7 +308,7 @@ final class InitDeinitTests: XCTestCase { } func testInitDeinit20() { - AssertParse( + assertParse( """ extension BarProtocol { init(x : Int) {} @@ -319,7 +319,7 @@ final class InitDeinitTests: XCTestCase { } func testInitDeinit21() { - AssertParse( + assertParse( """ func fooFunc() { init() {} @@ -330,7 +330,7 @@ final class InitDeinitTests: XCTestCase { } func testInitDeinit22() { - AssertParse( + assertParse( """ func barFunc() { var x : () = { () -> () in @@ -348,7 +348,7 @@ final class InitDeinitTests: XCTestCase { func testInitDeinit24() { // https://github.com/apple/swift/issues/43464 - AssertParse( + assertParse( """ class Aaron { convenience init() { init(x: 1) } @@ -358,7 +358,7 @@ final class InitDeinitTests: XCTestCase { } func testInitDeinit25() { - AssertParse( + assertParse( """ class Theodosia: Aaron { init() { @@ -370,7 +370,7 @@ final class InitDeinitTests: XCTestCase { } func testInitDeinit26() { - AssertParse( + assertParse( """ struct AaronStruct { init(x: Int) {} @@ -381,7 +381,7 @@ final class InitDeinitTests: XCTestCase { } func testInitDeinit27() { - AssertParse( + assertParse( """ enum AaronEnum: Int { case A = 1 @@ -392,7 +392,7 @@ final class InitDeinitTests: XCTestCase { } func testInitDeinit28() { - AssertParse( + assertParse( """ init(_ foo: T) 1️⃣-> Int where T: Comparable {} """, @@ -403,7 +403,7 @@ final class InitDeinitTests: XCTestCase { } func testDeinitInSwiftinterfaceIsFollowedByFinalFunc() { - AssertParse( + assertParse( """ class Foo { deinit diff --git a/Tests/SwiftParserTest/translated/InvalidIfExprTests.swift b/Tests/SwiftParserTest/translated/InvalidIfExprTests.swift index 65edbbbd13e..3ba07ade092 100644 --- a/Tests/SwiftParserTest/translated/InvalidIfExprTests.swift +++ b/Tests/SwiftParserTest/translated/InvalidIfExprTests.swift @@ -16,7 +16,7 @@ import XCTest final class InvalidIfExprTests: XCTestCase { func testInvalidIfExpr1() { - AssertParse( + assertParse( """ (a ? b1️⃣) """, @@ -28,7 +28,7 @@ final class InvalidIfExprTests: XCTestCase { } func testInvalidIfExpr2() { - AssertParse( + assertParse( """ (a ? b : c ? d1️⃣) """, @@ -40,7 +40,7 @@ final class InvalidIfExprTests: XCTestCase { } func testInvalidIfExpr3() { - AssertParse( + assertParse( """ (a ? b ? c : d1️⃣ """, @@ -53,7 +53,7 @@ final class InvalidIfExprTests: XCTestCase { } func testInvalidIfExpr4() { - AssertParse( + assertParse( """ (a ? b ? c1️⃣) """, diff --git a/Tests/SwiftParserTest/translated/InvalidStringInterpolationProtocolTests.swift b/Tests/SwiftParserTest/translated/InvalidStringInterpolationProtocolTests.swift index 951cb0f955d..0e3a1d50d2a 100644 --- a/Tests/SwiftParserTest/translated/InvalidStringInterpolationProtocolTests.swift +++ b/Tests/SwiftParserTest/translated/InvalidStringInterpolationProtocolTests.swift @@ -16,7 +16,7 @@ import XCTest final class InvalidStringInterpolationProtocolTests: XCTestCase { func testInvalidStringInterpolationProtocol1() { - AssertParse( + assertParse( """ // Has a lot of invalid 'appendInterpolation' methods public struct BadStringInterpolation: StringInterpolationProtocol { @@ -39,7 +39,7 @@ final class InvalidStringInterpolationProtocolTests: XCTestCase { } func testInvalidStringInterpolationProtocol2() { - AssertParse( + assertParse( """ // Has no 'appendInterpolation' methods at all public struct IncompleteStringInterpolation: StringInterpolationProtocol { @@ -51,7 +51,7 @@ final class InvalidStringInterpolationProtocolTests: XCTestCase { } func testInvalidStringInterpolationProtocol3() { - AssertParse( + assertParse( """ // Has only good 'appendInterpolation' methods. public struct GoodStringInterpolation: StringInterpolationProtocol { @@ -67,7 +67,7 @@ final class InvalidStringInterpolationProtocolTests: XCTestCase { } func testInvalidStringInterpolationProtocol4() { - AssertParse( + assertParse( """ // Has only good 'appendInterpolation' methods, but they're in an extension. public struct GoodSplitStringInterpolation: StringInterpolationProtocol { @@ -79,7 +79,7 @@ final class InvalidStringInterpolationProtocolTests: XCTestCase { } func testInvalidStringInterpolationProtocol5() { - AssertParse( + assertParse( """ extension GoodSplitStringInterpolation { public func appendInterpolation(noResult: ()) {} @@ -92,7 +92,7 @@ final class InvalidStringInterpolationProtocolTests: XCTestCase { } func testInvalidStringInterpolationProtocol6() { - AssertParse( + assertParse( """ // Has only good 'appendInterpolation' methods, and is not public. struct GoodNonPublicStringInterpolation: StringInterpolationProtocol { @@ -108,7 +108,7 @@ final class InvalidStringInterpolationProtocolTests: XCTestCase { } func testInvalidStringInterpolationProtocol7() { - AssertParse( + assertParse( """ // Has a mixture of good and bad 'appendInterpolation' methods. // We don't emit any errors in this case--we assume the others diff --git a/Tests/SwiftParserTest/translated/InvalidTests.swift b/Tests/SwiftParserTest/translated/InvalidTests.swift index 20b53cf31eb..18dd7027775 100644 --- a/Tests/SwiftParserTest/translated/InvalidTests.swift +++ b/Tests/SwiftParserTest/translated/InvalidTests.swift @@ -17,7 +17,7 @@ import XCTest final class InvalidTests: XCTestCase { func testInvalid1a() { // rdar://15946844 - AssertParse( + assertParse( """ func test1(1️⃣inout var x : Int) {} """, @@ -29,7 +29,7 @@ final class InvalidTests: XCTestCase { } func testInvalid1b() { - AssertParse( + assertParse( """ func test2(1️⃣inout let x : Int) {} """, @@ -40,7 +40,7 @@ final class InvalidTests: XCTestCase { } func testInvalid1c() { - AssertParse( + assertParse( """ func test3(f : (1️⃣inout _ x : Int) -> Void) {} """, @@ -52,7 +52,7 @@ final class InvalidTests: XCTestCase { } func testInvalid2a() { - AssertParse( + assertParse( """ func test1s(1️⃣__shared var x : Int) {} """, @@ -63,7 +63,7 @@ final class InvalidTests: XCTestCase { } func testInvalid2b() { - AssertParse( + assertParse( """ func test2s(1️⃣__shared let x : Int) {} """, @@ -74,7 +74,7 @@ final class InvalidTests: XCTestCase { } func testInvalid3a() { - AssertParse( + assertParse( """ func test1o(1️⃣__owned var x : Int) {} """, @@ -85,7 +85,7 @@ final class InvalidTests: XCTestCase { } func testInvalid3b() { - AssertParse( + assertParse( """ func test2o(1️⃣__owned let x : Int) {} """, @@ -96,7 +96,7 @@ final class InvalidTests: XCTestCase { } func testInvalid4() { - AssertParse( + assertParse( """ func test3() { undeclared_func( 1️⃣ @@ -109,7 +109,7 @@ final class InvalidTests: XCTestCase { } func testInvalid5() { - AssertParse( + assertParse( """ func runAction() {} """ @@ -117,7 +117,7 @@ final class InvalidTests: XCTestCase { } func testInvalid6() { - AssertParse( + assertParse( """ // rdar://16601779 func foo() { @@ -132,7 +132,7 @@ final class InvalidTests: XCTestCase { } func testInvalid7() { - AssertParse( + assertParse( """ super.init() """ @@ -140,7 +140,7 @@ final class InvalidTests: XCTestCase { } func testInvalid8() { - AssertParse( + assertParse( """ switch state { 1️⃣let duration : Int = 0 @@ -155,7 +155,7 @@ final class InvalidTests: XCTestCase { } func testInvalid9() { - AssertParse( + assertParse( #""" func testNotCoveredCase(x: Int) { switch x { @@ -180,7 +180,7 @@ final class InvalidTests: XCTestCase { } func testInvalid10() { - AssertParse( + assertParse( ##""" // rdar://18926814 func test4() { @@ -196,7 +196,7 @@ final class InvalidTests: XCTestCase { func testInvalid11() { // rdar://problem/18507467 - AssertParse( + assertParse( """ func d(_ b: 1️⃣String 2️⃣-> 3️⃣() -> T4️⃣) {} """, @@ -211,7 +211,7 @@ final class InvalidTests: XCTestCase { } func testInvalid12() { - AssertParse( + assertParse( """ // QoI: terrible diagnostic when trying to form a generic protocol protocol Animal { @@ -222,7 +222,7 @@ final class InvalidTests: XCTestCase { } func testInvalid13() { - AssertParse( + assertParse( """ // https://github.com/apple/swift/issues/43190 // Crash with invalid parameter declaration @@ -241,7 +241,7 @@ final class InvalidTests: XCTestCase { } func testInvalid14() { - AssertParse( + assertParse( """ // https://github.com/apple/swift/issues/43313 do { @@ -256,7 +256,7 @@ final class InvalidTests: XCTestCase { } func testInvalid15() { - AssertParse( + assertParse( """ // https://github.com/apple/swift/issues/43591 // Two inout crash compiler @@ -265,7 +265,7 @@ final class InvalidTests: XCTestCase { } func testInvalid16a() { - AssertParse( + assertParse( """ func f1_43591(a : inout 1️⃣inout Int) {} """, @@ -276,7 +276,7 @@ final class InvalidTests: XCTestCase { } func testInvalid16b() { - AssertParse( + assertParse( """ func f2_43591(1️⃣inout inout b: Int) {} """, @@ -288,7 +288,7 @@ final class InvalidTests: XCTestCase { } func testInvalid16c() { - AssertParse( + assertParse( """ func f3_43591(let let 1️⃣a: Int) {} """, @@ -299,7 +299,7 @@ final class InvalidTests: XCTestCase { } func testInvalid16d() { - AssertParse( + assertParse( """ func f4_43591(1️⃣inout x: inout String) {} """, @@ -310,7 +310,7 @@ final class InvalidTests: XCTestCase { } func testInvalid16e() { - AssertParse( + assertParse( """ func f5_43591(1️⃣inout i: inout Int) {} """, @@ -321,7 +321,7 @@ final class InvalidTests: XCTestCase { } func testInvalid17() { - AssertParse( + assertParse( """ func 1️⃣repeat() {} """, @@ -332,7 +332,7 @@ final class InvalidTests: XCTestCase { } func testInvalid18() { - AssertParse( + assertParse( """ let 1️⃣for = 2 """, @@ -343,7 +343,7 @@ final class InvalidTests: XCTestCase { } func testInvalid19() { - AssertParse( + assertParse( """ func f4_43591(1️⃣inout x: inout String) {} """, @@ -354,7 +354,7 @@ final class InvalidTests: XCTestCase { } func testInvalid20() { - AssertParse( + assertParse( """ func f5_43591(1️⃣inout i: inout Int) {} """, @@ -366,7 +366,7 @@ final class InvalidTests: XCTestCase { } func testInvalid21() { - AssertParse( + assertParse( """ func 1️⃣repeat() {} """, @@ -377,7 +377,7 @@ final class InvalidTests: XCTestCase { } func testInvalid22() { - AssertParse( + assertParse( """ let 1️⃣for = 2 """, @@ -388,7 +388,7 @@ final class InvalidTests: XCTestCase { } func testInvalid23a() { - AssertParse( + assertParse( """ func dog 1️⃣cow() {} """, @@ -407,7 +407,7 @@ final class InvalidTests: XCTestCase { } func testInvalid23b() { - AssertParse( + assertParse( """ func dog 1️⃣cow() {} """, @@ -426,7 +426,7 @@ final class InvalidTests: XCTestCase { } func testThreeIdentifersForFunctionName() { - AssertParse( + assertParse( """ func dog 1️⃣cow sheep() {} """, @@ -445,7 +445,7 @@ final class InvalidTests: XCTestCase { } func testInvalid24() { - AssertParse( + assertParse( """ func cat 1️⃣Mouse() {} """, @@ -457,7 +457,7 @@ final class InvalidTests: XCTestCase { } func testInvalid25() { - AssertParse( + assertParse( """ func friend 1️⃣ship(x: T) {} """, @@ -476,7 +476,7 @@ final class InvalidTests: XCTestCase { } func testInvalid26() { - AssertParse( + assertParse( """ func were1️⃣ wolf2️⃣() {} @@ -490,7 +490,7 @@ final class InvalidTests: XCTestCase { } func testInvalid27() { - AssertParse( + assertParse( """ func hammer1️⃣ leavings2️⃣(x: T) {} @@ -504,7 +504,7 @@ final class InvalidTests: XCTestCase { } func testInvalid28() { - AssertParse( + assertParse( """ prefix operator % prefix func %(x: T) -> T { return x } // No error expected - the < is considered an identifier but is peeled off by the parser. @@ -513,7 +513,7 @@ final class InvalidTests: XCTestCase { } func testInvalid29() { - AssertParse( + assertParse( """ struct Weak { weak let value: T @@ -531,7 +531,7 @@ final class InvalidTests: XCTestCase { } func testInvalid30() { - AssertParse( + assertParse( """ let x: () = () !() @@ -544,7 +544,7 @@ final class InvalidTests: XCTestCase { func testInvalid32() { // https://github.com/apple/swift/issues/50734 - AssertParse( + assertParse( """ func f1_50734(@NSApplicationMain x: Int) {} """ @@ -552,7 +552,7 @@ final class InvalidTests: XCTestCase { } func testInvalid33() { - AssertParse( + assertParse( """ func f2_50734(@available(iOS, deprecated: 0) x: Int) {} """ @@ -560,7 +560,7 @@ final class InvalidTests: XCTestCase { } func testInvalid34() { - AssertParse( + assertParse( """ func f3_50734(@discardableResult x: Int) {} """ @@ -568,7 +568,7 @@ final class InvalidTests: XCTestCase { } func testInvalid35() { - AssertParse( + assertParse( """ func f4_50734(@objcMembers x: String) {} """ @@ -576,7 +576,7 @@ final class InvalidTests: XCTestCase { } func testInvalid36() { - AssertParse( + assertParse( """ func f5_50734(@weak x: String) {} """ @@ -584,7 +584,7 @@ final class InvalidTests: XCTestCase { } func testInvalid37() { - AssertParse( + assertParse( """ class C_50734<@NSApplicationMain T: AnyObject> {} """ @@ -592,7 +592,7 @@ final class InvalidTests: XCTestCase { } func testInvalid38() { - AssertParse( + assertParse( """ func f6_50734<@discardableResult T>(x: T) {} """ @@ -600,7 +600,7 @@ final class InvalidTests: XCTestCase { } func testInvalid39() { - AssertParse( + assertParse( """ enum E_50734<@indirect T> {} """ @@ -608,7 +608,7 @@ final class InvalidTests: XCTestCase { } func testInvalid40() { - AssertParse( + assertParse( """ protocol P { @available(swift, introduced: 4.2) associatedtype Assoc diff --git a/Tests/SwiftParserTest/translated/MatchingPatternsTests.swift b/Tests/SwiftParserTest/translated/MatchingPatternsTests.swift index 85f70569c85..041eb9ddc2c 100644 --- a/Tests/SwiftParserTest/translated/MatchingPatternsTests.swift +++ b/Tests/SwiftParserTest/translated/MatchingPatternsTests.swift @@ -16,7 +16,7 @@ import XCTest final class MatchingPatternsTests: XCTestCase { func testMatchingPatterns1() { - AssertParse( + assertParse( """ import imported_enums """ @@ -24,7 +24,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns3() { - AssertParse( + assertParse( """ var x:Int """ @@ -32,7 +32,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns4() { - AssertParse( + assertParse( """ func square(_ x: Int) -> Int { return x*x } """ @@ -40,7 +40,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns5() { - AssertParse( + assertParse( """ struct A { struct C { } @@ -50,7 +50,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns6() { - AssertParse( + assertParse( #""" switch x { // Expressions as patterns. @@ -85,7 +85,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns7() { - AssertParse( + assertParse( """ switch (x,x) { case (var a, var a): @@ -98,7 +98,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns8() { - AssertParse( + assertParse( """ var e : Any = 0 """ @@ -106,7 +106,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns9() { - AssertParse( + assertParse( """ switch e { // 'is' pattern. @@ -122,7 +122,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns10() { - AssertParse( + assertParse( """ // Enum patterns. enum Foo { case A, B, C } @@ -131,7 +131,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns11() { - AssertParse( + assertParse( """ func == (_: Voluntary, _: Voluntary) -> Bool { return true } """ @@ -139,7 +139,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns12() { - AssertParse( + assertParse( """ enum Voluntary : Equatable { case Naught @@ -178,7 +178,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns13() { - AssertParse( + assertParse( """ var n : Voluntary = .Naught if case let .Naught(value) = n {} @@ -189,7 +189,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns14() { - AssertParse( + assertParse( """ switch n { case Foo.A: @@ -219,7 +219,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns15() { - AssertParse( + assertParse( """ var notAnEnum = 0 """ @@ -227,7 +227,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns16() { - AssertParse( + assertParse( """ switch notAnEnum { case .Foo: @@ -238,7 +238,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns17() { - AssertParse( + assertParse( """ struct ContainsEnum { enum Possible { @@ -262,7 +262,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns18() { - AssertParse( + assertParse( """ func nonmemberAccessesMemberType(_ n: ContainsEnum.Possible) { switch n { @@ -276,7 +276,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns19() { - AssertParse( + assertParse( """ var m : ImportedEnum = .Simple """ @@ -284,7 +284,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns20() { - AssertParse( + assertParse( """ switch m { case imported_enums.ImportedEnum.Simple, @@ -304,7 +304,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns21() { - AssertParse( + assertParse( """ // Check that single-element tuple payloads work sensibly in patterns. """ @@ -312,7 +312,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns22() { - AssertParse( + assertParse( """ enum LabeledScalarPayload { case Payload(name: Int) @@ -322,7 +322,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns23() { - AssertParse( + assertParse( """ var lsp: LabeledScalarPayload = .Payload(name: 0) func acceptInt(_: Int) {} @@ -332,7 +332,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns24() { - AssertParse( + assertParse( #""" switch lsp { case .Payload(0): @@ -368,7 +368,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns25() { - AssertParse( + assertParse( """ // Property patterns. """ @@ -376,7 +376,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns26() { - AssertParse( + assertParse( """ struct S { static var stat: Int = 0 @@ -391,7 +391,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns27() { - AssertParse( + assertParse( """ // Tuple patterns. """ @@ -399,7 +399,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns28() { - AssertParse( + assertParse( """ var t = (1, 2, 3) """ @@ -407,7 +407,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns29() { - AssertParse( + assertParse( """ prefix operator +++ infix operator +++ @@ -420,7 +420,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns30() { - AssertParse( + assertParse( """ switch t { case (_, var a, 3): @@ -446,7 +446,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns31() { - AssertParse( + assertParse( #""" // FIXME: We don't currently allow subpatterns for "isa" patterns that // require interesting conditional downcasts. @@ -457,7 +457,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns32() { - AssertParse( + assertParse( """ switch [Derived(), Derived(), Base()] { case let ds as [Derived]: @@ -472,7 +472,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns33() { - AssertParse( + assertParse( """ // Optional patterns. let op1 : Int? @@ -482,7 +482,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns34() { - AssertParse( + assertParse( """ switch op1 { case nil: break @@ -494,7 +494,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns35() { - AssertParse( + assertParse( """ switch op2 { case nil: break @@ -507,7 +507,7 @@ final class MatchingPatternsTests: XCTestCase { } func testMatchingPatterns36() { - AssertParse( + assertParse( #""" // Bogus diagnostic "refutable pattern match can fail" let (responseObject: Int1️⃣?) = op1 diff --git a/Tests/SwiftParserTest/translated/MetatypeObjectConversionTests.swift b/Tests/SwiftParserTest/translated/MetatypeObjectConversionTests.swift index 5d2a0caf947..f186abcf5d1 100644 --- a/Tests/SwiftParserTest/translated/MetatypeObjectConversionTests.swift +++ b/Tests/SwiftParserTest/translated/MetatypeObjectConversionTests.swift @@ -16,7 +16,7 @@ import XCTest final class MetatypeObjectConversionTests: XCTestCase { func testMetatypeObjectConversion1() { - AssertParse( + assertParse( """ class C {} struct S {} @@ -25,7 +25,7 @@ final class MetatypeObjectConversionTests: XCTestCase { } func testMetatypeObjectConversion2() { - AssertParse( + assertParse( """ protocol NonClassProto {} protocol ClassConstrainedProto : class {} @@ -34,7 +34,7 @@ final class MetatypeObjectConversionTests: XCTestCase { } func testMetatypeObjectConversion3() { - AssertParse( + assertParse( """ func takesAnyObject(_ x: AnyObject) {} """ @@ -42,7 +42,7 @@ final class MetatypeObjectConversionTests: XCTestCase { } func testMetatypeObjectConversion4() { - AssertParse( + assertParse( """ func concreteTypes() { takesAnyObject(C.self) @@ -54,7 +54,7 @@ final class MetatypeObjectConversionTests: XCTestCase { } func testMetatypeObjectConversion5() { - AssertParse( + assertParse( """ func existentialMetatypes(nonClass: NonClassProto.Type, classConstrained: ClassConstrainedProto.Type, diff --git a/Tests/SwiftParserTest/translated/MoveExprTests.swift b/Tests/SwiftParserTest/translated/MoveExprTests.swift index c2487db501a..081a970ff1b 100644 --- a/Tests/SwiftParserTest/translated/MoveExprTests.swift +++ b/Tests/SwiftParserTest/translated/MoveExprTests.swift @@ -16,7 +16,7 @@ import XCTest final class MoveExprTests: XCTestCase { func testMoveExpr1() { - AssertParse( + assertParse( """ var global: Int = 5 func testGlobal() { @@ -27,7 +27,7 @@ final class MoveExprTests: XCTestCase { } func testMoveExpr2() { - AssertParse( + assertParse( """ func testLet() { let t = String() @@ -38,7 +38,7 @@ final class MoveExprTests: XCTestCase { } func testMoveExpr3() { - AssertParse( + assertParse( """ func testVar() { var t = String() diff --git a/Tests/SwiftParserTest/translated/MultilineErrorsTests.swift b/Tests/SwiftParserTest/translated/MultilineErrorsTests.swift index 52bd111d00b..adb96da9949 100644 --- a/Tests/SwiftParserTest/translated/MultilineErrorsTests.swift +++ b/Tests/SwiftParserTest/translated/MultilineErrorsTests.swift @@ -16,7 +16,7 @@ import XCTest import SwiftSyntax -func AssertParseWithAllNewlineEndings( +func assertParseWithAllNewlineEndings( _ markedSource: String, substructure expectedSubstructure: Syntax? = nil, substructureAfterMarker: String = "START", @@ -27,7 +27,7 @@ func AssertParseWithAllNewlineEndings( line: UInt = #line ) { for newline in ["\n", "\r", "\r\n"] { - AssertParse( + assertParse( markedSource.replacingOccurrences(of: "\n", with: newline), substructure: expectedSubstructure, substructureAfterMarker: substructureAfterMarker, @@ -43,7 +43,7 @@ func AssertParseWithAllNewlineEndings( final class MultilineErrorsTests: XCTestCase { func testMultilineErrors1() { - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( """ import Swift """ @@ -51,7 +51,7 @@ final class MultilineErrorsTests: XCTestCase { } func testMultilineErrors2() { - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( """ // ===---------- Multiline --------=== """ @@ -60,7 +60,7 @@ final class MultilineErrorsTests: XCTestCase { func testMultilineErrors3() { // expecting at least 4 columns of leading indentation - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( #""" _ = """ Eleven @@ -85,7 +85,7 @@ final class MultilineErrorsTests: XCTestCase { func testMultilineErrors4() { // expecting at least 4 columns of leading indentation - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( #""" _ = """ Eleven @@ -106,7 +106,7 @@ final class MultilineErrorsTests: XCTestCase { func testMultilineErrors5() { // \t is not the same as an actual tab - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( #""" _ = """ Twelve @@ -126,7 +126,7 @@ final class MultilineErrorsTests: XCTestCase { } func testMultilineErrors6a() { - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( #""" _ = """ \(42 @@ -146,7 +146,7 @@ final class MultilineErrorsTests: XCTestCase { } func testMultilineErrors6b() { - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( #""" _ = """ \(42 @@ -166,7 +166,7 @@ final class MultilineErrorsTests: XCTestCase { } func testMultilineErrors7() { - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( #""" _ = """ Foo @@ -189,7 +189,7 @@ final class MultilineErrorsTests: XCTestCase { func testMultilineErrors8() { // a tab is not the same as multiple spaces - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( #""" _ = """ Thirteen @@ -210,7 +210,7 @@ final class MultilineErrorsTests: XCTestCase { func testMultilineErrors9() { // a tab is not the same as multiple spaces - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( #""" _ = """ Fourteen @@ -231,7 +231,7 @@ final class MultilineErrorsTests: XCTestCase { func testMultilineErrors10() { // multiple spaces are not the same as a tab - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( #""" _ = """ Thirteen 2 @@ -252,7 +252,7 @@ final class MultilineErrorsTests: XCTestCase { func testMultilineErrors11() { // multiple spaces are not the same as a tab - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( #""" _ = """ Fourteen 2 @@ -266,7 +266,7 @@ final class MultilineErrorsTests: XCTestCase { } func testMultilineErrors12() { - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( #""" _ = """1️⃣Fourteen Pi @@ -285,7 +285,7 @@ final class MultilineErrorsTests: XCTestCase { } func testMultilineErrors13() { - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( #""" _ = """ Fourteen @@ -304,7 +304,7 @@ final class MultilineErrorsTests: XCTestCase { } func testMultilineErrors14() { - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( #""" _ = """1️⃣""" """#, @@ -319,7 +319,7 @@ final class MultilineErrorsTests: XCTestCase { } func testMultilineErrors15() { - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( #""" _ = """ 1️⃣""" """#, @@ -335,7 +335,7 @@ final class MultilineErrorsTests: XCTestCase { func testMultilineErrors16() { // two lines should get only one error - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( #""" _ = """ 1️⃣ Hello, @@ -355,7 +355,7 @@ final class MultilineErrorsTests: XCTestCase { } func testMultilineErrors17a() { - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( #""" _ = """ 1️⃣Zero A @@ -397,7 +397,7 @@ final class MultilineErrorsTests: XCTestCase { } func testMultilineErrors17b() { - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( #""" _ = """ 1️⃣Zero A\(1)B @@ -419,7 +419,7 @@ final class MultilineErrorsTests: XCTestCase { } func testMultilineErrors17c() { - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( #""" _ = """ 1️⃣Incorrect 1 @@ -442,7 +442,7 @@ final class MultilineErrorsTests: XCTestCase { } func testMultilineErrors18() { - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( ##""" _ = "hello\(""" world @@ -458,7 +458,7 @@ final class MultilineErrorsTests: XCTestCase { } func testMultilineErrors19() { - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( ##""" _ = "h\(1️⃣ """ @@ -474,7 +474,7 @@ final class MultilineErrorsTests: XCTestCase { } func testMultilineErrors20() { - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( ##""" _ = """ line one 1️⃣\ non-whitespace @@ -488,7 +488,7 @@ final class MultilineErrorsTests: XCTestCase { } func testMultilineErrors21() { - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( #""" _ = """ line one @@ -508,7 +508,7 @@ final class MultilineErrorsTests: XCTestCase { } func testMultilineErrors22() { - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( #""" _ = """ \\1️⃣\ \#u{20} @@ -526,7 +526,7 @@ final class MultilineErrorsTests: XCTestCase { } func testMultilineErrors23() { - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( #""" _ = """ \(42)1️⃣\ \#t @@ -544,7 +544,7 @@ final class MultilineErrorsTests: XCTestCase { } func testMultilineErrors24() { - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( #""" _ = """ foo1️⃣\ @@ -562,7 +562,7 @@ final class MultilineErrorsTests: XCTestCase { } func testMultilineErrors25() { - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( #""" _ = """ foo1️⃣\ @@ -580,7 +580,7 @@ final class MultilineErrorsTests: XCTestCase { } func testMultilineErrors26() { - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( ##""" _ = """ foo1️⃣\2️⃣ @@ -593,7 +593,7 @@ final class MultilineErrorsTests: XCTestCase { } func testMultilineErrors28() { - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( #""" _ = """ 1️⃣\ @@ -611,7 +611,7 @@ final class MultilineErrorsTests: XCTestCase { } func testMultilineErrors29() { - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( #""" _ = """1️⃣\ """ @@ -629,7 +629,7 @@ final class MultilineErrorsTests: XCTestCase { } func testMultilineErrors30() { - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( ##""" let _ = """ foo @@ -653,7 +653,7 @@ final class MultilineErrorsTests: XCTestCase { } func testMultilineErrors31() { - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( ##""" let _ = """ foo @@ -672,7 +672,7 @@ final class MultilineErrorsTests: XCTestCase { } func testMultilineEndsWithStringInterpolation() { - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( #""" _ = """ \(1)1️⃣""" @@ -689,7 +689,7 @@ final class MultilineErrorsTests: XCTestCase { } func testInsufficientIndentationInInterpolation() { - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( #""" """ \( @@ -709,7 +709,7 @@ final class MultilineErrorsTests: XCTestCase { """# ) - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( #""" """ \( @@ -734,7 +734,7 @@ final class MultilineErrorsTests: XCTestCase { """# ) - AssertParseWithAllNewlineEndings( + assertParseWithAllNewlineEndings( #""" """ \( @@ -760,7 +760,7 @@ final class MultilineErrorsTests: XCTestCase { } func testWhitespaceAfterOpenQuote() { - AssertParse( + assertParse( #""" """1️⃣\#(" ") """ diff --git a/Tests/SwiftParserTest/translated/MultilinePoundDiagnosticArgRdar41154797Tests.swift b/Tests/SwiftParserTest/translated/MultilinePoundDiagnosticArgRdar41154797Tests.swift index 4a65f005e3c..ee0a506abe2 100644 --- a/Tests/SwiftParserTest/translated/MultilinePoundDiagnosticArgRdar41154797Tests.swift +++ b/Tests/SwiftParserTest/translated/MultilinePoundDiagnosticArgRdar41154797Tests.swift @@ -16,7 +16,7 @@ import XCTest final class MultilinePoundDiagnosticArgRdar41154797Tests: XCTestCase { func testMultilinePoundDiagnosticArgRdar411547971() { - AssertParse( + assertParse( ##""" #error("""1️⃣ """##, diff --git a/Tests/SwiftParserTest/translated/MultilineStringTests.swift b/Tests/SwiftParserTest/translated/MultilineStringTests.swift index 672a2e16a36..0ca78fdf1dc 100644 --- a/Tests/SwiftParserTest/translated/MultilineStringTests.swift +++ b/Tests/SwiftParserTest/translated/MultilineStringTests.swift @@ -18,7 +18,7 @@ import XCTest final class MultilineStringTests: XCTestCase { func testMultilineString1() { - AssertParse( + assertParse( """ import Swift """ @@ -26,7 +26,7 @@ final class MultilineStringTests: XCTestCase { } func testMultilineString2() { - AssertParse( + assertParse( """ // ===---------- Multiline --------=== """ @@ -34,7 +34,7 @@ final class MultilineStringTests: XCTestCase { } func testMultilineString3() { - AssertParse( + assertParse( #""" _ = """ One @@ -45,7 +45,7 @@ final class MultilineStringTests: XCTestCase { } func testMultilineString4() { - AssertParse( + assertParse( #""" _ = """ Two @@ -56,7 +56,7 @@ final class MultilineStringTests: XCTestCase { } func testMultilineString5() { - AssertParse( + assertParse( #""" _ = """ Three @@ -67,7 +67,7 @@ final class MultilineStringTests: XCTestCase { } func testMultilineString6() { - AssertParse( + assertParse( #""" _ = """ Four @@ -78,7 +78,7 @@ final class MultilineStringTests: XCTestCase { } func testMultilineString7() { - AssertParse( + assertParse( #""" _ = """ Five\n @@ -90,7 +90,7 @@ final class MultilineStringTests: XCTestCase { } func testMultilineString9() { - AssertParse( + assertParse( #""" _ = """ Six @@ -102,7 +102,7 @@ final class MultilineStringTests: XCTestCase { } func testMultilineString11() { - AssertParse( + assertParse( #""" _ = """ Seven @@ -113,7 +113,7 @@ final class MultilineStringTests: XCTestCase { } func testMultilineString12() { - AssertParse( + assertParse( #""" _ = """ \""" @@ -126,7 +126,7 @@ final class MultilineStringTests: XCTestCase { } func testMultilineString13() { - AssertParse( + assertParse( #""" _ = """ \("Nine") @@ -137,7 +137,7 @@ final class MultilineStringTests: XCTestCase { } func testMultilineString14() { - AssertParse( + assertParse( #""" _ = """ first @@ -149,7 +149,7 @@ final class MultilineStringTests: XCTestCase { } func testMultilineString15() { - AssertParse( + assertParse( #""" _ = """ first @@ -161,7 +161,7 @@ final class MultilineStringTests: XCTestCase { } func testMultilineString16() { - AssertParse( + assertParse( #""" _ = """ \\ @@ -171,7 +171,7 @@ final class MultilineStringTests: XCTestCase { } func testMultilineString17() { - AssertParse( + assertParse( #""" _ = """ \\ @@ -181,7 +181,7 @@ final class MultilineStringTests: XCTestCase { } func testMultilineString18() { - AssertParse( + assertParse( #""" _ = """ @@ -192,7 +192,7 @@ final class MultilineStringTests: XCTestCase { } func testMultilineString20() { - AssertParse( + assertParse( #""" _ = """ @@ -203,7 +203,7 @@ final class MultilineStringTests: XCTestCase { } func testMultilineString22() { - AssertParse( + assertParse( #""" _ = """ @@ -214,7 +214,7 @@ final class MultilineStringTests: XCTestCase { } func testMultilineString24() { - AssertParse( + assertParse( #""" // contains tabs _ = """ @@ -226,7 +226,7 @@ final class MultilineStringTests: XCTestCase { } func testMultilineString25() { - AssertParse( + assertParse( #""" _ = """ newline \ @@ -238,7 +238,7 @@ final class MultilineStringTests: XCTestCase { func testMultilineString26() { // contains trailing whitespace - AssertParse( + assertParse( #""" _ = """ trailing \ @@ -257,7 +257,7 @@ final class MultilineStringTests: XCTestCase { func testMultilineString27() { // contains trailing whitespace - AssertParse( + assertParse( #""" _ = """ foo @@ -270,7 +270,7 @@ final class MultilineStringTests: XCTestCase { func testMultilineString29() { // contains trailing whitespace - AssertParse( + assertParse( #""" _ = """ foo\\#u{20} @@ -282,7 +282,7 @@ final class MultilineStringTests: XCTestCase { } func testMultilineString31() { - AssertParse( + assertParse( #""" _ = """ foo \ @@ -293,7 +293,7 @@ final class MultilineStringTests: XCTestCase { } func testMultilineString32() { - AssertParse( + assertParse( #""" _ = """ @@ -304,7 +304,7 @@ final class MultilineStringTests: XCTestCase { } func testMultilineString34() { - AssertParse( + assertParse( #""" _ = """ @@ -316,7 +316,7 @@ final class MultilineStringTests: XCTestCase { } func testMultilineString37() { - AssertParse( + assertParse( #""" _ = """ @@ -327,7 +327,7 @@ final class MultilineStringTests: XCTestCase { } func testMultilineString39() { - AssertParse( + assertParse( #""" _ = """ @@ -337,7 +337,7 @@ final class MultilineStringTests: XCTestCase { } func testMultilineString41() { - AssertParse( + assertParse( #""" _ = """ """ @@ -346,7 +346,7 @@ final class MultilineStringTests: XCTestCase { } func testMultilineString42() { - AssertParse( + assertParse( #""" _ = "\(""" \("a" + """ @@ -358,7 +358,7 @@ final class MultilineStringTests: XCTestCase { } func testMultilineString43() { - AssertParse( + assertParse( #""" _ = "hello\(""" world @@ -368,7 +368,7 @@ final class MultilineStringTests: XCTestCase { } func testMultilineString44() { - AssertParse( + assertParse( #""" _ = """ hello\(""" @@ -381,7 +381,7 @@ final class MultilineStringTests: XCTestCase { } func testMultilineString45() { - AssertParse( + assertParse( #""" _ = "hello\(""" "world' @@ -391,7 +391,7 @@ final class MultilineStringTests: XCTestCase { } func testMultilineString46() { - AssertParse( + assertParse( #""" _ = """ welcome @@ -412,7 +412,7 @@ final class MultilineStringTests: XCTestCase { } func testEscapeNewlineInRawString() { - AssertParse( + assertParse( ##""" #""" Three \# @@ -441,7 +441,7 @@ final class MultilineStringTests: XCTestCase { // We really shouldn't be allow the last newline in the multi-line string // literal to be escaped in a multi-line string literal. But since the C++ // parser accepts this, so does SwiftParser. - AssertParse( + assertParse( ##""" #""" Three \# diff --git a/Tests/SwiftParserTest/translated/NoimplicitcopyAttrTests.swift b/Tests/SwiftParserTest/translated/NoimplicitcopyAttrTests.swift index 372d09f91b6..c531288738d 100644 --- a/Tests/SwiftParserTest/translated/NoimplicitcopyAttrTests.swift +++ b/Tests/SwiftParserTest/translated/NoimplicitcopyAttrTests.swift @@ -16,7 +16,7 @@ import XCTest final class NoimplicitcopyAttrTests: XCTestCase { func testNoimplicitcopyAttr1() { - AssertParse( + assertParse( """ f// RUN: %target-typecheck-verify-swift -parse -parse-stdlib -disable-availability-checking -verify-syntax-tree """ @@ -24,7 +24,7 @@ final class NoimplicitcopyAttrTests: XCTestCase { } func testNoimplicitcopyAttr2() { - AssertParse( + assertParse( """ import Swift """ @@ -32,7 +32,7 @@ final class NoimplicitcopyAttrTests: XCTestCase { } func testNoimplicitcopyAttr3() { - AssertParse( + assertParse( """ class Klass {} """ @@ -40,7 +40,7 @@ final class NoimplicitcopyAttrTests: XCTestCase { } func testNoimplicitcopyAttr4() { - AssertParse( + assertParse( """ func argumentsAndReturns(@_noImplicitCopy _ x: Klass) -> Klass { return x @@ -50,7 +50,7 @@ final class NoimplicitcopyAttrTests: XCTestCase { } func testNoimplicitcopyAttr5() { - AssertParse( + assertParse( """ func letDecls(@_noImplicitCopy _ x: Klass) -> () { @_noImplicitCopy let y: Klass = x @@ -61,7 +61,7 @@ final class NoimplicitcopyAttrTests: XCTestCase { } func testNoimplicitcopyAttr6() { - AssertParse( + assertParse( """ func varDecls(@_noImplicitCopy _ x: Klass, @_noImplicitCopy _ x2: Klass) -> () { @_noImplicitCopy var y: Klass = x @@ -73,7 +73,7 @@ final class NoimplicitcopyAttrTests: XCTestCase { } func testNoimplicitcopyAttr7() { - AssertParse( + assertParse( """ func getKlass() -> Builtin.NativeObject { let k = Klass() @@ -85,7 +85,7 @@ final class NoimplicitcopyAttrTests: XCTestCase { } func testNoimplicitcopyAttr8() { - AssertParse( + assertParse( """ @_noImplicitCopy var g: Builtin.NativeObject = getKlass() @_noImplicitCopy let g2: Builtin.NativeObject = getKlass() diff --git a/Tests/SwiftParserTest/translated/NumberIdentifierErrorsTests.swift b/Tests/SwiftParserTest/translated/NumberIdentifierErrorsTests.swift index 99010887d7d..e8309d712d4 100644 --- a/Tests/SwiftParserTest/translated/NumberIdentifierErrorsTests.swift +++ b/Tests/SwiftParserTest/translated/NumberIdentifierErrorsTests.swift @@ -16,7 +16,7 @@ import XCTest final class NumberIdentifierErrorsTests: XCTestCase { func testNumberIdentifierErrors1() { - AssertParse( + assertParse( """ // Per rdar://problem/32316666 , it is a common mistake for beginners // to start a function name with a number, so it's worth @@ -26,7 +26,7 @@ final class NumberIdentifierErrorsTests: XCTestCase { } func testNumberIdentifierErrors2a() { - AssertParse( + assertParse( """ func 1️⃣1() {} """, @@ -37,7 +37,7 @@ final class NumberIdentifierErrorsTests: XCTestCase { } func testNumberIdentifierErrors2b() { - AssertParse( + assertParse( """ func 1️⃣2.0() {} """, @@ -48,7 +48,7 @@ final class NumberIdentifierErrorsTests: XCTestCase { } func testNumberIdentifierErrors2c() { - AssertParse( + assertParse( """ func 1️⃣3func() {} """, @@ -59,7 +59,7 @@ final class NumberIdentifierErrorsTests: XCTestCase { } func testNumberIdentifierErrors3a() { - AssertParse( + assertParse( """ protocol 1️⃣4 { associatedtype 2️⃣5 @@ -73,7 +73,7 @@ final class NumberIdentifierErrorsTests: XCTestCase { } func testNumberIdentifierErrors3b() { - AssertParse( + assertParse( """ protocol 1️⃣6.0 { associatedtype 2️⃣7.0 @@ -87,7 +87,7 @@ final class NumberIdentifierErrorsTests: XCTestCase { } func testNumberIdentifierErrors3c() { - AssertParse( + assertParse( """ protocol 1️⃣8protocol { associatedtype 2️⃣9associatedtype @@ -101,7 +101,7 @@ final class NumberIdentifierErrorsTests: XCTestCase { } func testNumberIdentifierErrors4a() { - AssertParse( + assertParse( """ typealias 1️⃣10 = Int """, @@ -112,7 +112,7 @@ final class NumberIdentifierErrorsTests: XCTestCase { } func testNumberIdentifierErrors4b() { - AssertParse( + assertParse( """ typealias 1️⃣11.0 = Int """, @@ -123,7 +123,7 @@ final class NumberIdentifierErrorsTests: XCTestCase { } func testNumberIdentifierErrors4c() { - AssertParse( + assertParse( """ typealias 1️⃣12typealias = Int """, @@ -134,7 +134,7 @@ final class NumberIdentifierErrorsTests: XCTestCase { } func testNumberIdentifierErrors5a() { - AssertParse( + assertParse( """ struct 1️⃣13 {} """, @@ -145,7 +145,7 @@ final class NumberIdentifierErrorsTests: XCTestCase { } func testNumberIdentifierErrors5b() { - AssertParse( + assertParse( """ struct 1️⃣14.0 {} """, @@ -156,7 +156,7 @@ final class NumberIdentifierErrorsTests: XCTestCase { } func testNumberIdentifierErrors5c() { - AssertParse( + assertParse( """ struct 1️⃣15struct {} """, @@ -167,7 +167,7 @@ final class NumberIdentifierErrorsTests: XCTestCase { } func testNumberIdentifierErrors6a() { - AssertParse( + assertParse( """ enum 1️⃣16 {} """, @@ -178,7 +178,7 @@ final class NumberIdentifierErrorsTests: XCTestCase { } func testNumberIdentifierErrors6b() { - AssertParse( + assertParse( """ enum 1️⃣17.0 {} """, @@ -189,7 +189,7 @@ final class NumberIdentifierErrorsTests: XCTestCase { } func testNumberIdentifierErrors6c() { - AssertParse( + assertParse( """ enum 1️⃣18enum {} """, @@ -200,7 +200,7 @@ final class NumberIdentifierErrorsTests: XCTestCase { } func testNumberIdentifierErrors7a() { - AssertParse( + assertParse( """ class 1️⃣19 { func 2️⃣20() {} @@ -214,7 +214,7 @@ final class NumberIdentifierErrorsTests: XCTestCase { } func testNumberIdentifierErrors7b() { - AssertParse( + assertParse( """ class 1️⃣21.0 { func 2️⃣22.0() {} @@ -228,7 +228,7 @@ final class NumberIdentifierErrorsTests: XCTestCase { } func testNumberIdentifierErrors8() { - AssertParse( + assertParse( """ class 1️⃣23class { func 2️⃣24method() {} diff --git a/Tests/SwiftParserTest/translated/ObjcEnumTests.swift b/Tests/SwiftParserTest/translated/ObjcEnumTests.swift index 23a526cffbd..a2e8b43b980 100644 --- a/Tests/SwiftParserTest/translated/ObjcEnumTests.swift +++ b/Tests/SwiftParserTest/translated/ObjcEnumTests.swift @@ -16,7 +16,7 @@ import XCTest final class ObjcEnumTests: XCTestCase { func testObjcEnum1() { - AssertParse( + assertParse( """ @objc enum Foo: Int32 { case Zim, Zang, Zung @@ -26,7 +26,7 @@ final class ObjcEnumTests: XCTestCase { } func testObjcEnum2() { - AssertParse( + assertParse( """ @objc enum Generic: Int32 { case Zim, Zang, Zung @@ -36,7 +36,7 @@ final class ObjcEnumTests: XCTestCase { } func testObjcEnum3() { - AssertParse( + assertParse( """ @objc(EnumRuntimeName) enum RuntimeNamed: Int32 { case Zim, Zang, Zung @@ -46,7 +46,7 @@ final class ObjcEnumTests: XCTestCase { } func testObjcEnum4() { - AssertParse( + assertParse( """ @objc enum NoRawType { case Zim, Zang, Zung @@ -56,7 +56,7 @@ final class ObjcEnumTests: XCTestCase { } func testObjcEnum5() { - AssertParse( + assertParse( """ @objc enum NonIntegerRawType: Float { case Zim = 1.0, Zang = 1.5, Zung = 2.0 @@ -66,7 +66,7 @@ final class ObjcEnumTests: XCTestCase { } func testObjcEnum6() { - AssertParse( + assertParse( """ enum NonObjCEnum: Int { case Zim, Zang, Zung @@ -76,7 +76,7 @@ final class ObjcEnumTests: XCTestCase { } func testObjcEnum7() { - AssertParse( + assertParse( """ class Bar { @objc func foo(x: Foo) {} @@ -87,7 +87,7 @@ final class ObjcEnumTests: XCTestCase { } func testObjcEnum8() { - AssertParse( + assertParse( """ // @objc enums with payloads rejected with no source location info @objc enum r23681566 : Int32 { diff --git a/Tests/SwiftParserTest/translated/ObjectLiteralsTests.swift b/Tests/SwiftParserTest/translated/ObjectLiteralsTests.swift index 98301e41847..02f695b5c0a 100644 --- a/Tests/SwiftParserTest/translated/ObjectLiteralsTests.swift +++ b/Tests/SwiftParserTest/translated/ObjectLiteralsTests.swift @@ -16,7 +16,7 @@ import XCTest final class ObjectLiteralsTests: XCTestCase { func testObjectLiterals1a() { - AssertParse( + assertParse( """ let _ = [#Color(colorLiteralRed: red, green: green, blue: blue, alpha: alpha)#1️⃣] """, @@ -27,7 +27,7 @@ final class ObjectLiteralsTests: XCTestCase { } func testObjectLiterals1b() { - AssertParse( + assertParse( """ let _ = [#Image(imageLiteral: localResourceNameAsString)#1️⃣] """, @@ -38,7 +38,7 @@ final class ObjectLiteralsTests: XCTestCase { } func testObjectLiterals1c() { - AssertParse( + assertParse( """ let _ = [#FileReference(fileReferenceLiteral: localResourceNameAsString)#1️⃣] """, @@ -49,7 +49,7 @@ final class ObjectLiteralsTests: XCTestCase { } func testObjectLiterals2a() { - AssertParse( + assertParse( """ let _ = #Color(colorLiteralRed: red, green: green, blue: blue, alpha: alpha) """ @@ -57,7 +57,7 @@ final class ObjectLiteralsTests: XCTestCase { } func testObjectLiterals2b() { - AssertParse( + assertParse( """ let _ = #Image(imageLiteral: localResourceNameAsString) """ @@ -65,7 +65,7 @@ final class ObjectLiteralsTests: XCTestCase { } func testObjectLiterals2c() { - AssertParse( + assertParse( """ let _ = #FileReference(fileReferenceLiteral: localResourceNameAsString) """ @@ -73,7 +73,7 @@ final class ObjectLiteralsTests: XCTestCase { } func testObjectLiterals3a() { - AssertParse( + assertParse( """ let _ = #notAPound """ @@ -81,7 +81,7 @@ final class ObjectLiteralsTests: XCTestCase { } func testObjectLiterals3b() { - AssertParse( + assertParse( """ let _ = #notAPound(1, 2) """ @@ -89,7 +89,7 @@ final class ObjectLiteralsTests: XCTestCase { } func testObjectLiterals3c() { - AssertParse( + assertParse( """ let _ = #Color """ @@ -97,7 +97,7 @@ final class ObjectLiteralsTests: XCTestCase { } func testObjectLiterals4() { - AssertParse( + assertParse( """ let _ = [#1️⃣#2️⃣] """, @@ -109,7 +109,7 @@ final class ObjectLiteralsTests: XCTestCase { } func testObjectLiterals5() { - AssertParse( + assertParse( """ let _ = [#Color(_: 1, green: 1, 2)2️⃣ """, @@ -120,7 +120,7 @@ final class ObjectLiteralsTests: XCTestCase { } func testObjectLiterals6() { - AssertParse( + assertParse( """ let _ = [1️⃣#Color(red: 1, green: 1, blue: 1)#2️⃣3️⃣ """, @@ -132,7 +132,7 @@ final class ObjectLiteralsTests: XCTestCase { } func testObjectLiterals7() { - AssertParse( + assertParse( """ let _ = [#Color(withRed: 1, green: 1, whatever: 2)#1️⃣] """, @@ -143,7 +143,7 @@ final class ObjectLiteralsTests: XCTestCase { } func testObjectLiterals8() { - AssertParse( + assertParse( """ let _ = #Color(_: 1, green: 1) """ diff --git a/Tests/SwiftParserTest/translated/OperatorDeclDesignatedTypesTests.swift b/Tests/SwiftParserTest/translated/OperatorDeclDesignatedTypesTests.swift index bad22fcc25c..a43022caaa0 100644 --- a/Tests/SwiftParserTest/translated/OperatorDeclDesignatedTypesTests.swift +++ b/Tests/SwiftParserTest/translated/OperatorDeclDesignatedTypesTests.swift @@ -18,7 +18,7 @@ import XCTest final class OperatorDeclDesignatedTypesTests: XCTestCase { func testOperatorDeclDesignatedTypes1() { - AssertParse( + assertParse( """ precedencegroup LowPrecedence { associativity: right @@ -28,7 +28,7 @@ final class OperatorDeclDesignatedTypesTests: XCTestCase { } func testOperatorDeclDesignatedTypes2() { - AssertParse( + assertParse( """ precedencegroup MediumPrecedence { associativity: left @@ -39,7 +39,7 @@ final class OperatorDeclDesignatedTypesTests: XCTestCase { } func testOperatorDeclDesignatedTypes3() { - AssertParse( + assertParse( """ protocol PrefixMagicOperatorProtocol { } @@ -48,7 +48,7 @@ final class OperatorDeclDesignatedTypesTests: XCTestCase { } func testOperatorDeclDesignatedTypes4() { - AssertParse( + assertParse( """ protocol PostfixMagicOperatorProtocol { } @@ -57,7 +57,7 @@ final class OperatorDeclDesignatedTypesTests: XCTestCase { } func testOperatorDeclDesignatedTypes5() { - AssertParse( + assertParse( """ protocol InfixMagicOperatorProtocol { } @@ -66,7 +66,7 @@ final class OperatorDeclDesignatedTypesTests: XCTestCase { } func testOperatorDeclDesignatedTypes6() { - AssertParse( + assertParse( """ prefix operator ^^ : PrefixMagicOperatorProtocol infix operator <*< : MediumPrecedence, InfixMagicOperatorProtocol @@ -76,7 +76,7 @@ final class OperatorDeclDesignatedTypesTests: XCTestCase { } func testOperatorDeclDesignatedTypes7() { - AssertParse( + assertParse( """ infix operator ^*^ prefix operator *^^ @@ -86,7 +86,7 @@ final class OperatorDeclDesignatedTypesTests: XCTestCase { } func testOperatorDeclDesignatedTypes8() { - AssertParse( + assertParse( """ infix operator **>> : UndeclaredPrecedence """ @@ -94,7 +94,7 @@ final class OperatorDeclDesignatedTypesTests: XCTestCase { } func testOperatorDeclDesignatedTypes9() { - AssertParse( + assertParse( """ infix operator **+> : MediumPrecedence, UndeclaredProtocol """ @@ -102,7 +102,7 @@ final class OperatorDeclDesignatedTypesTests: XCTestCase { } func testOperatorDeclDesignatedTypes10() { - AssertParse( + assertParse( """ prefix operator *+*> : MediumPrecedence """ @@ -110,7 +110,7 @@ final class OperatorDeclDesignatedTypesTests: XCTestCase { } func testOperatorDeclDesignatedTypes11() { - AssertParse( + assertParse( """ postfix operator ++*> : MediumPrecedence """ @@ -118,7 +118,7 @@ final class OperatorDeclDesignatedTypesTests: XCTestCase { } func testOperatorDeclDesignatedTypes12() { - AssertParse( + assertParse( """ prefix operator *++> : UndeclaredProtocol postfix operator +*+> : UndeclaredProtocol @@ -127,7 +127,7 @@ final class OperatorDeclDesignatedTypesTests: XCTestCase { } func testOperatorDeclDesignatedTypes13() { - AssertParse( + assertParse( """ struct Struct {} class Class {} @@ -138,7 +138,7 @@ final class OperatorDeclDesignatedTypesTests: XCTestCase { } func testOperatorDeclDesignatedTypes14() { - AssertParse( + assertParse( """ prefix operator **>> : Struct prefix operator *>*> : Class @@ -147,7 +147,7 @@ final class OperatorDeclDesignatedTypesTests: XCTestCase { } func testOperatorDeclDesignatedTypes15() { - AssertParse( + assertParse( """ postfix operator >*>* : Struct postfix operator >>** : Class @@ -156,7 +156,7 @@ final class OperatorDeclDesignatedTypesTests: XCTestCase { } func testOperatorDeclDesignatedTypes16() { - AssertParse( + assertParse( """ infix operator <*<<< : MediumPrecedence, & """ @@ -164,7 +164,7 @@ final class OperatorDeclDesignatedTypesTests: XCTestCase { } func testOperatorDeclDesignatedTypes17() { - AssertParse( + assertParse( """ infix operator **^^ : MediumPrecedence infix operator **^^ : InfixMagicOperatorProtocol @@ -173,7 +173,7 @@ final class OperatorDeclDesignatedTypesTests: XCTestCase { } func testOperatorDeclDesignatedTypes18() { - AssertParse( + assertParse( """ infix operator ^%*%^ : MediumPrecedence, Struct, Class infix operator ^%*%% : Struct, Class @@ -186,7 +186,7 @@ final class OperatorDeclDesignatedTypesTests: XCTestCase { } func testOperatorDeclDesignatedTypes19() { - AssertParse( + assertParse( """ infix operator <*<>*> : AdditionPrecedence, """ diff --git a/Tests/SwiftParserTest/translated/OperatorDeclTests.swift b/Tests/SwiftParserTest/translated/OperatorDeclTests.swift index 065c53c79c2..ad0f92010b2 100644 --- a/Tests/SwiftParserTest/translated/OperatorDeclTests.swift +++ b/Tests/SwiftParserTest/translated/OperatorDeclTests.swift @@ -16,7 +16,7 @@ import XCTest final class OperatorDeclTests: XCTestCase { func testOperatorDecl1a() { - AssertParse( + assertParse( """ prefix operator +++ 1️⃣{} """, @@ -28,7 +28,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl1b() { - AssertParse( + assertParse( """ postfix operator +++ 1️⃣{} """, @@ -39,7 +39,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl1c() { - AssertParse( + assertParse( """ infix operator +++ 1️⃣{} """, @@ -50,7 +50,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl1d() { - AssertParse( + assertParse( """ infix operator +++* 1️⃣{ associativity right @@ -66,7 +66,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl1e() { - AssertParse( + assertParse( """ infix operator +++*+ : A 1️⃣{ } """, @@ -77,7 +77,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl2() { - AssertParse( + assertParse( """ prefix operator +++** : A 1️⃣{ } """, @@ -88,7 +88,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl3() { - AssertParse( + assertParse( """ prefix operator ++*++ : A """ @@ -96,7 +96,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl4() { - AssertParse( + assertParse( """ postfix operator ++*+* : A 1️⃣{ } """, @@ -107,7 +107,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl5() { - AssertParse( + assertParse( """ postfix operator ++**+ : A """ @@ -115,7 +115,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl6() { - AssertParse( + assertParse( """ operator ++*** : A """, @@ -126,7 +126,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl7() { - AssertParse( + assertParse( """ operator +*+++ 1️⃣{ } """, @@ -138,7 +138,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl8() { - AssertParse( + assertParse( """ operator +*++* : A 1️⃣{ } """, @@ -150,7 +150,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl9() { - AssertParse( + assertParse( """ prefix operator1️⃣ """, @@ -161,7 +161,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl10() { - AssertParse( + assertParse( """ 1️⃣; prefix operator %%+ @@ -173,7 +173,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl11a() { - AssertParse( + assertParse( """ prefix operator ?? """ @@ -181,7 +181,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl11b() { - AssertParse( + assertParse( """ postfix operator ?? """ @@ -189,7 +189,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl11c() { - AssertParse( + assertParse( """ prefix operator !! """ @@ -197,7 +197,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl11d() { - AssertParse( + assertParse( """ postfix operator !! """ @@ -205,7 +205,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl11e() { - AssertParse( + assertParse( """ postfix operator ?1️⃣$$ """, @@ -217,7 +217,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl12a() { - AssertParse( + assertParse( """ infix operator --1️⃣aa """, @@ -229,7 +229,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl12b() { - AssertParse( + assertParse( """ infix operator 1️⃣aa--: A """, @@ -241,7 +241,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl12c() { - AssertParse( + assertParse( """ infix operator <<1️⃣$$@< """, @@ -253,7 +253,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl12d() { - AssertParse( + assertParse( """ infix operator !!1️⃣@aa2️⃣ """, @@ -264,7 +264,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl12e() { - AssertParse( + assertParse( """ infix operator 1️⃣#++= """, @@ -276,7 +276,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl12f() { - AssertParse( + assertParse( """ infix operator ++=1️⃣# """, @@ -287,7 +287,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl12g() { - AssertParse( + assertParse( """ infix operator ->1️⃣# """, @@ -298,7 +298,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl13() { - AssertParse( + assertParse( """ // FIXME: Ideally, we shouldn't emit the «consistent whitespace» diagnostic // where = cannot possibly mean an assignment. @@ -311,7 +311,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl14() { - AssertParse( + assertParse( """ infix operator +++= infix operator *** : A @@ -324,7 +324,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl15a() { - AssertParse( + assertParse( """ precedencegroup 1️⃣{ associativity: right @@ -337,7 +337,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl15b() { - AssertParse( + assertParse( """ precedencegroup A { associativity 1️⃣right @@ -350,7 +350,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl15c() { - AssertParse( + assertParse( """ precedencegroup B { 1️⃣precedence 123 @@ -363,7 +363,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl15d() { - AssertParse( + assertParse( """ precedencegroup C { associativity: 1️⃣sinister @@ -376,7 +376,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl15e() { - AssertParse( + assertParse( """ precedencegroup D { assignment: 1️⃣no @@ -389,7 +389,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl15() { - AssertParse( + assertParse( """ precedencegroup E { higherThan:1️⃣ @@ -402,7 +402,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl16() { - AssertParse( + assertParse( """ precedencegroup F { higherThan: A, B, C @@ -412,7 +412,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl17() { - AssertParse( + assertParse( """ precedencegroup BangBangBang { associativity: none @@ -423,7 +423,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl18() { - AssertParse( + assertParse( """ precedencegroup CaretCaretCaret { assignment: true @@ -434,7 +434,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl19() { - AssertParse( + assertParse( """ class Foo { infix operator ||| @@ -444,7 +444,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl20() { - AssertParse( + assertParse( """ infix operator **<< : UndeclaredPrecedenceGroup """ @@ -453,7 +453,7 @@ final class OperatorDeclTests: XCTestCase { func testOperatorDecl21() { // TODO: We should not allow specification of multiple precedence groups - AssertParse( + assertParse( """ protocol Proto {} infix operator *<*< : F, Proto @@ -462,7 +462,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl22() { - AssertParse( + assertParse( """ // https://github.com/apple/swift/issues/60932 """ @@ -470,7 +470,7 @@ final class OperatorDeclTests: XCTestCase { } func testOperatorDecl23() { - AssertParse( + assertParse( """ postfix operator ++:1️⃣ """, @@ -481,7 +481,7 @@ final class OperatorDeclTests: XCTestCase { } func testIdentifierAsOperatorName() { - AssertParse( + assertParse( "postfix operator 1️⃣aa", diagnostics: [ DiagnosticSpec(message: "'aa' is considered an identifier and must not appear within an operator name") @@ -490,6 +490,6 @@ final class OperatorDeclTests: XCTestCase { } func testRegexLikeOperator() { - AssertParse("prefix operator /^/") + assertParse("prefix operator /^/") } } diff --git a/Tests/SwiftParserTest/translated/OperatorsTests.swift b/Tests/SwiftParserTest/translated/OperatorsTests.swift index a97dce38a38..0a1c364f3c7 100644 --- a/Tests/SwiftParserTest/translated/OperatorsTests.swift +++ b/Tests/SwiftParserTest/translated/OperatorsTests.swift @@ -16,7 +16,7 @@ import XCTest final class OperatorsTests: XCTestCase { func testOperators1() { - AssertParse( + assertParse( """ // This disables importing the stdlib intentionally. """ @@ -24,7 +24,7 @@ final class OperatorsTests: XCTestCase { } func testOperators2() { - AssertParse( + assertParse( """ infix operator == : Equal precedencegroup Equal { @@ -36,7 +36,7 @@ final class OperatorsTests: XCTestCase { } func testOperators3() { - AssertParse( + assertParse( """ infix operator & : BitAnd precedencegroup BitAnd { @@ -48,7 +48,7 @@ final class OperatorsTests: XCTestCase { } func testOperators4() { - AssertParse( + assertParse( """ infix operator => : FatArrow precedencegroup FatArrow { @@ -63,7 +63,7 @@ final class OperatorsTests: XCTestCase { } func testOperators5() { - AssertParse( + assertParse( """ precedencegroup DefaultPrecedence {} """ @@ -71,7 +71,7 @@ final class OperatorsTests: XCTestCase { } func testOperators6() { - AssertParse( + assertParse( """ struct Man {} struct TheDevil {} @@ -81,7 +81,7 @@ final class OperatorsTests: XCTestCase { } func testOperators7() { - AssertParse( + assertParse( """ struct Five {} struct Six {} @@ -91,7 +91,7 @@ final class OperatorsTests: XCTestCase { } func testOperators8() { - AssertParse( + assertParse( """ struct ManIsFive {} struct TheDevilIsSix {} @@ -101,7 +101,7 @@ final class OperatorsTests: XCTestCase { } func testOperators9() { - AssertParse( + assertParse( """ struct TheDevilIsSixThenGodIsSeven {} """ @@ -109,7 +109,7 @@ final class OperatorsTests: XCTestCase { } func testOperators10() { - AssertParse( + assertParse( """ func == (x: Man, y: Five) -> ManIsFive {} func == (x: TheDevil, y: Six) -> TheDevilIsSix {} @@ -119,7 +119,7 @@ final class OperatorsTests: XCTestCase { } func testOperators11() { - AssertParse( + assertParse( """ func => (x: TheDevilIsSix, y: GodIsSeven) -> TheDevilIsSixThenGodIsSeven {} func => (x: ManIsFive, y: TheDevilIsSixThenGodIsSeven) {} @@ -128,7 +128,7 @@ final class OperatorsTests: XCTestCase { } func testOperators12() { - AssertParse( + assertParse( """ func test1() { Man() == Five() => TheDevil() == Six() => God() == Seven() @@ -138,7 +138,7 @@ final class OperatorsTests: XCTestCase { } func testOperators13() { - AssertParse( + assertParse( """ postfix operator *!* prefix operator *!* @@ -147,7 +147,7 @@ final class OperatorsTests: XCTestCase { } func testOperators14() { - AssertParse( + assertParse( """ struct LOOK {} struct LOOKBang { @@ -158,7 +158,7 @@ final class OperatorsTests: XCTestCase { } func testOperators15() { - AssertParse( + assertParse( """ postfix func *!* (x: LOOK) -> LOOKBang {} prefix func *!* (x: LOOKBang) {} @@ -167,7 +167,7 @@ final class OperatorsTests: XCTestCase { } func testOperators16() { - AssertParse( + assertParse( """ func test2() { *!*LOOK()*!* @@ -177,7 +177,7 @@ final class OperatorsTests: XCTestCase { } func testOperators17() { - AssertParse( + assertParse( """ // This should be parsed as (x*!*).exclaim() LOOK()*!*.exclaim() @@ -186,7 +186,7 @@ final class OperatorsTests: XCTestCase { } func testOperators18() { - AssertParse( + assertParse( """ prefix operator ^ infix operator ^ @@ -196,7 +196,7 @@ final class OperatorsTests: XCTestCase { } func testOperators19() { - AssertParse( + assertParse( """ postfix func ^ (x: God) -> TheDevil {} prefix func ^ (x: TheDevil) -> God {} @@ -205,7 +205,7 @@ final class OperatorsTests: XCTestCase { } func testOperators20() { - AssertParse( + assertParse( """ func ^ (x: TheDevil, y: God) -> Man {} """ @@ -213,7 +213,7 @@ final class OperatorsTests: XCTestCase { } func testOperators21() { - AssertParse( + assertParse( """ var _ : TheDevil = God()^ var _ : God = ^TheDevil() @@ -225,7 +225,7 @@ final class OperatorsTests: XCTestCase { } func testOperators22() { - AssertParse( + assertParse( """ postfix func ^ (x: Man) -> () -> God { return { return God() } @@ -235,7 +235,7 @@ final class OperatorsTests: XCTestCase { } func testOperators23() { - AssertParse( + assertParse( """ var _ : God = Man()^() """ @@ -243,7 +243,7 @@ final class OperatorsTests: XCTestCase { } func testOperators24() { - AssertParse( + assertParse( """ func &(x : Man, y : Man) -> Man { return x } // forgive amp_prefix token """ @@ -251,7 +251,7 @@ final class OperatorsTests: XCTestCase { } func testOperators25() { - AssertParse( + assertParse( """ prefix operator ⚽️ """ @@ -259,7 +259,7 @@ final class OperatorsTests: XCTestCase { } func testOperators26() { - AssertParse( + assertParse( """ prefix func ⚽️(x: Man) { } """ @@ -267,7 +267,7 @@ final class OperatorsTests: XCTestCase { } func testOperators27() { - AssertParse( + assertParse( """ infix operator ?? : OptTest precedencegroup OptTest { @@ -278,7 +278,7 @@ final class OperatorsTests: XCTestCase { } func testOperators28() { - AssertParse( + assertParse( """ func ??(x: Man, y: TheDevil) -> TheDevil { return y @@ -288,7 +288,7 @@ final class OperatorsTests: XCTestCase { } func testOperators29() { - AssertParse( + assertParse( """ func test3(a: Man, b: Man, c: TheDevil) -> TheDevil { return a ?? b ?? c @@ -298,7 +298,7 @@ final class OperatorsTests: XCTestCase { } func testOperators30() { - AssertParse( + assertParse( """ // We don't parse infix operators bound on both // sides that begin with ! or ? correctly yet. @@ -308,7 +308,7 @@ final class OperatorsTests: XCTestCase { } func testOperators31() { - AssertParse( + assertParse( """ func !!(x: Man, y: Man) {} """ @@ -316,7 +316,7 @@ final class OperatorsTests: XCTestCase { } func testOperators32() { - AssertParse( + assertParse( """ let foo = Man() """ @@ -324,7 +324,7 @@ final class OperatorsTests: XCTestCase { } func testOperators33() { - AssertParse( + assertParse( """ let bar = TheDevil() """ @@ -332,7 +332,7 @@ final class OperatorsTests: XCTestCase { } func testOperators34() { - AssertParse( + assertParse( """ foo!!1️⃣foo """, @@ -343,7 +343,7 @@ final class OperatorsTests: XCTestCase { } func testOperators35() { - AssertParse( + assertParse( """ foo??1️⃣bar """, diff --git a/Tests/SwiftParserTest/translated/OptionalChainLvaluesTests.swift b/Tests/SwiftParserTest/translated/OptionalChainLvaluesTests.swift index a1a84bb60b0..a24815bd5e6 100644 --- a/Tests/SwiftParserTest/translated/OptionalChainLvaluesTests.swift +++ b/Tests/SwiftParserTest/translated/OptionalChainLvaluesTests.swift @@ -16,7 +16,7 @@ import XCTest final class OptionalChainLvaluesTests: XCTestCase { func testOptionalChainLvalues1() { - AssertParse( + assertParse( """ struct S { var x: Int = 0 @@ -29,7 +29,7 @@ final class OptionalChainLvaluesTests: XCTestCase { } func testOptionalChainLvalues2() { - AssertParse( + assertParse( """ struct T { var mutS: S? = nil @@ -42,7 +42,7 @@ final class OptionalChainLvaluesTests: XCTestCase { } func testOptionalChainLvalues3() { - AssertParse( + assertParse( """ var mutT: T? let immT: T? = nil @@ -51,7 +51,7 @@ final class OptionalChainLvaluesTests: XCTestCase { } func testOptionalChainLvalues4() { - AssertParse( + assertParse( """ postfix operator ++ prefix operator ++ @@ -60,7 +60,7 @@ final class OptionalChainLvaluesTests: XCTestCase { } func testOptionalChainLvalues5() { - AssertParse( + assertParse( """ public postfix func ++ (rhs: inout T) -> T { fatalError() } public prefix func ++ (rhs: inout T) -> T { fatalError() } @@ -69,7 +69,7 @@ final class OptionalChainLvaluesTests: XCTestCase { } func testOptionalChainLvalues6() { - AssertParse( + assertParse( """ mutT?.mutateT() immT?.mutateT() @@ -82,7 +82,7 @@ final class OptionalChainLvaluesTests: XCTestCase { } func testOptionalChainLvalues7() { - AssertParse( + assertParse( """ // Prefix operators don't chain ++mutT?.mutS?.x @@ -92,7 +92,7 @@ final class OptionalChainLvaluesTests: XCTestCase { } func testOptionalChainLvalues8() { - AssertParse( + assertParse( """ mutT? = T() mutT?.mutS = S() diff --git a/Tests/SwiftParserTest/translated/OptionalLvaluesTests.swift b/Tests/SwiftParserTest/translated/OptionalLvaluesTests.swift index 9a860e19a47..1766b08f9a8 100644 --- a/Tests/SwiftParserTest/translated/OptionalLvaluesTests.swift +++ b/Tests/SwiftParserTest/translated/OptionalLvaluesTests.swift @@ -16,7 +16,7 @@ import XCTest final class OptionalLvaluesTests: XCTestCase { func testOptionalLvalues1() { - AssertParse( + assertParse( """ struct S { var x: Int = 0 @@ -28,7 +28,7 @@ final class OptionalLvaluesTests: XCTestCase { } func testOptionalLvalues2() { - AssertParse( + assertParse( """ struct T { var mutS: S? = nil @@ -40,7 +40,7 @@ final class OptionalLvaluesTests: XCTestCase { } func testOptionalLvalues3() { - AssertParse( + assertParse( """ var mutT: T? let immT: T? = nil // expected-note 4 {{change 'let' to 'var' to make it mutable}} {{1-4=var}} {{1-4=var}} {{1-4=var}} {{1-4=var}} @@ -49,7 +49,7 @@ final class OptionalLvaluesTests: XCTestCase { } func testOptionalLvalues4() { - AssertParse( + assertParse( """ let mutTPayload = mutT! """ @@ -57,7 +57,7 @@ final class OptionalLvaluesTests: XCTestCase { } func testOptionalLvalues5() { - AssertParse( + assertParse( """ mutT! = T() mutT!.mutS = S() @@ -73,7 +73,7 @@ final class OptionalLvaluesTests: XCTestCase { } func testOptionalLvalues6() { - AssertParse( + assertParse( """ immT! = T() immT!.mutS = S() @@ -89,7 +89,7 @@ final class OptionalLvaluesTests: XCTestCase { } func testOptionalLvalues7() { - AssertParse( + assertParse( """ var mutIUO: T! = nil let immIUO: T! = nil // expected-note 2 {{change 'let' to 'var' to make it mutable}} {{1-4=var}} {{1-4=var}} @@ -98,7 +98,7 @@ final class OptionalLvaluesTests: XCTestCase { } func testOptionalLvalues8() { - AssertParse( + assertParse( """ mutIUO!.mutS = S() mutIUO!.immS = S() @@ -109,7 +109,7 @@ final class OptionalLvaluesTests: XCTestCase { } func testOptionalLvalues9() { - AssertParse( + assertParse( """ mutIUO.mutS = S() mutIUO.immS = S() @@ -120,7 +120,7 @@ final class OptionalLvaluesTests: XCTestCase { } func testOptionalLvalues10() { - AssertParse( + assertParse( """ func foo(x: Int) {} """ @@ -128,7 +128,7 @@ final class OptionalLvaluesTests: XCTestCase { } func testOptionalLvalues11() { - AssertParse( + assertParse( """ var nonOptional: S = S() _ = nonOptional! @@ -138,7 +138,7 @@ final class OptionalLvaluesTests: XCTestCase { } func testOptionalLvalues12() { - AssertParse( + assertParse( """ class C {} class D: C {} @@ -147,7 +147,7 @@ final class OptionalLvaluesTests: XCTestCase { } func testOptionalLvalues13() { - AssertParse( + assertParse( """ let c = C() let d = (c as! D)! diff --git a/Tests/SwiftParserTest/translated/OptionalTests.swift b/Tests/SwiftParserTest/translated/OptionalTests.swift index 3c6a3bda8a1..9ab16883500 100644 --- a/Tests/SwiftParserTest/translated/OptionalTests.swift +++ b/Tests/SwiftParserTest/translated/OptionalTests.swift @@ -17,7 +17,7 @@ import XCTest final class OptionalTests: XCTestCase { func testOptional1() { - AssertParse( + assertParse( """ struct A { func foo() {} @@ -27,7 +27,7 @@ final class OptionalTests: XCTestCase { } func testOptional2() { - AssertParse( + assertParse( """ var a : A? var b : A 1️⃣? @@ -39,7 +39,7 @@ final class OptionalTests: XCTestCase { } func testOptional3a() { - AssertParse( + assertParse( """ var c = a? """, @@ -53,7 +53,7 @@ final class OptionalTests: XCTestCase { } func testOptional3b() { - AssertParse( + assertParse( """ var d : ()? = a?.foo() """ @@ -61,7 +61,7 @@ final class OptionalTests: XCTestCase { } func testOptional4() { - AssertParse( + assertParse( """ var e : (() -> A)? var f = e?() @@ -70,7 +70,7 @@ final class OptionalTests: XCTestCase { } func testOptional5() { - AssertParse( + assertParse( """ struct B {} var g = B() diff --git a/Tests/SwiftParserTest/translated/OriginalDefinedInAttrTests.swift b/Tests/SwiftParserTest/translated/OriginalDefinedInAttrTests.swift index 52c79fb25fb..ef7bfffdd76 100644 --- a/Tests/SwiftParserTest/translated/OriginalDefinedInAttrTests.swift +++ b/Tests/SwiftParserTest/translated/OriginalDefinedInAttrTests.swift @@ -16,7 +16,7 @@ import XCTest final class OriginalDefinedInAttrTests: XCTestCase { func testOriginalDefinedInAttr1() { - AssertParse( + assertParse( #""" @_originallyDefinedIn(module: "foo", OSX 13.13) public func foo() {} @@ -25,7 +25,7 @@ final class OriginalDefinedInAttrTests: XCTestCase { } func testOriginalDefinedInAttr2() { - AssertParse( + assertParse( #""" @_originallyDefinedIn(1️⃣modulename: "foo", OSX 13.13) public func foo1() {} @@ -38,7 +38,7 @@ final class OriginalDefinedInAttrTests: XCTestCase { } func testOriginalDefinedInAttr3() { - AssertParse( + assertParse( #""" @_originallyDefinedIn(module: "foo", OSX 13.13.3) public class ToplevelClass {} @@ -47,7 +47,7 @@ final class OriginalDefinedInAttrTests: XCTestCase { } func testOriginalDefinedInAttr4() { - AssertParse( + assertParse( #""" @_originallyDefinedIn(module: "foo"1️⃣) public class ToplevelClass1 {} @@ -59,7 +59,7 @@ final class OriginalDefinedInAttrTests: XCTestCase { } func testOriginalDefinedInAttr5() { - AssertParse( + assertParse( """ @_originallyDefinedIn(1️⃣OSX 13.13.3) public class ToplevelClass2 {} @@ -71,7 +71,7 @@ final class OriginalDefinedInAttrTests: XCTestCase { } func testOriginalDefinedInAttr6() { - AssertParse( + assertParse( #""" @_originallyDefinedIn(module: "foo",1️⃣ public class ToplevelClass3 {} @@ -84,7 +84,7 @@ final class OriginalDefinedInAttrTests: XCTestCase { } func testOriginalDefinedInAttr7() { - AssertParse( + assertParse( #""" @available(OSX 13.10, *) @_originallyDefinedIn(module: "foo", * 13.13) @@ -92,7 +92,7 @@ final class OriginalDefinedInAttrTests: XCTestCase { """# ) - AssertParse( + assertParse( #""" @available(OSX 13.10, *) @_originallyDefinedIn(module: "foo", OSX 13.13, iOS 7.0) @@ -100,7 +100,7 @@ final class OriginalDefinedInAttrTests: XCTestCase { """# ) - AssertParse( + assertParse( #""" @available(OSX 13.10, *) @_originallyDefinedIn(module: "foo", OSX 13.14, * 7.0) @@ -108,7 +108,7 @@ final class OriginalDefinedInAttrTests: XCTestCase { """# ) - AssertParse( + assertParse( #""" public class ToplevelClass4 { @_originallyDefinedIn(module: "foo", OSX 13.13) @@ -122,7 +122,7 @@ final class OriginalDefinedInAttrTests: XCTestCase { } func testOriginalDefinedInAttr8() { - AssertParse( + assertParse( #""" @available(OSX 13.10, *) @_originallyDefinedIn(module: "foo", OSX 13.13) @@ -133,7 +133,7 @@ final class OriginalDefinedInAttrTests: XCTestCase { } func testOriginalDefinedInAttr9() { - AssertParse( + assertParse( #""" @available(OSX 13.10, *) @_originallyDefinedIn(module: "foo", OSX 13.13) @@ -144,7 +144,7 @@ final class OriginalDefinedInAttrTests: XCTestCase { } func testOriginalDefinedInAttr10() { - AssertParse( + assertParse( #""" @available(OSX 13.10, *) @_originallyDefinedIn(module: "foo", OSX 13.13) @@ -155,7 +155,7 @@ final class OriginalDefinedInAttrTests: XCTestCase { } func testOriginalDefinedInAttr11() { - AssertParse( + assertParse( #""" @available(OSX 13.10, *) @_originallyDefinedIn(module: "foo", OSX 13.13, iOS 7.0) @@ -165,7 +165,7 @@ final class OriginalDefinedInAttrTests: XCTestCase { } func testOrinalDefinedInAttr12() { - AssertParse( + assertParse( """ @_originallyDefinedIn(module: "ToasterKit", _iOS13Aligned) struct Vehicle {} diff --git a/Tests/SwiftParserTest/translated/PatternWithoutVariablesScriptTests.swift b/Tests/SwiftParserTest/translated/PatternWithoutVariablesScriptTests.swift index d779841abb4..1b5710d0bed 100644 --- a/Tests/SwiftParserTest/translated/PatternWithoutVariablesScriptTests.swift +++ b/Tests/SwiftParserTest/translated/PatternWithoutVariablesScriptTests.swift @@ -16,7 +16,7 @@ import XCTest final class PatternWithoutVariablesScriptTests: XCTestCase { func testPatternWithoutVariablesScript1() { - AssertParse( + assertParse( """ _ = 1 """ diff --git a/Tests/SwiftParserTest/translated/PatternWithoutVariablesTests.swift b/Tests/SwiftParserTest/translated/PatternWithoutVariablesTests.swift index e48b8ddee99..88de0d47c24 100644 --- a/Tests/SwiftParserTest/translated/PatternWithoutVariablesTests.swift +++ b/Tests/SwiftParserTest/translated/PatternWithoutVariablesTests.swift @@ -16,7 +16,7 @@ import XCTest final class PatternWithoutVariablesTests: XCTestCase { func testPatternWithoutVariables1() { - AssertParse( + assertParse( """ let _ = 1 inout _ = 1 @@ -25,7 +25,7 @@ final class PatternWithoutVariablesTests: XCTestCase { } func testPatternWithoutVariables2() { - AssertParse( + assertParse( """ func foo() { let _ = 1 // OK @@ -36,7 +36,7 @@ final class PatternWithoutVariablesTests: XCTestCase { } func testPatternWithoutVariables3() { - AssertParse( + assertParse( """ struct Foo { let _ = 1 @@ -51,7 +51,7 @@ final class PatternWithoutVariablesTests: XCTestCase { } func testPatternWithoutVariables4() { - AssertParse( + assertParse( #""" // Warn on "let" and "var" when no data is bound in a pattern enum SimpleEnum { case Bar } @@ -60,7 +60,7 @@ final class PatternWithoutVariablesTests: XCTestCase { } func testPatternWithoutVariables5() { - AssertParse( + assertParse( #""" func testVarLetPattern(a : SimpleEnum) { switch a { @@ -85,7 +85,7 @@ final class PatternWithoutVariablesTests: XCTestCase { } func testPatternWithoutVariables6() { - AssertParse( + assertParse( """ // https://github.com/apple/swift/issues/53293 class C_53293 { diff --git a/Tests/SwiftParserTest/translated/PlaygroundLvaluesTests.swift b/Tests/SwiftParserTest/translated/PlaygroundLvaluesTests.swift index bcd1e889a93..2b5ac0e883d 100644 --- a/Tests/SwiftParserTest/translated/PlaygroundLvaluesTests.swift +++ b/Tests/SwiftParserTest/translated/PlaygroundLvaluesTests.swift @@ -16,7 +16,7 @@ import XCTest final class PlaygroundLvaluesTests: XCTestCase { func testPlaygroundLvalues1() { - AssertParse( + assertParse( """ var a = 1, b = 2 let z = 3 @@ -25,7 +25,7 @@ final class PlaygroundLvaluesTests: XCTestCase { } func testPlaygroundLvalues2() { - AssertParse( + assertParse( """ a (a, b) diff --git a/Tests/SwiftParserTest/translated/PoundAssertTests.swift b/Tests/SwiftParserTest/translated/PoundAssertTests.swift index d718266817f..b18270c7094 100644 --- a/Tests/SwiftParserTest/translated/PoundAssertTests.swift +++ b/Tests/SwiftParserTest/translated/PoundAssertTests.swift @@ -16,7 +16,7 @@ import XCTest final class PoundAssertTests: XCTestCase { func testPoundAssert1() { - AssertParse( + assertParse( """ #assert(true, 1️⃣123) """ @@ -24,7 +24,7 @@ final class PoundAssertTests: XCTestCase { } func testPoundAssert2() { - AssertParse( + assertParse( #""" #assert(true, "error \(1) message") """# @@ -32,7 +32,7 @@ final class PoundAssertTests: XCTestCase { } func testPoundAssert3() { - AssertParse( + assertParse( #""" #assert1️⃣ true2️⃣, "error message") """#, @@ -44,7 +44,7 @@ final class PoundAssertTests: XCTestCase { } func testPoundAssert4() { - AssertParse( + assertParse( #""" #assert(1️⃣, "error message") """#, @@ -55,7 +55,7 @@ final class PoundAssertTests: XCTestCase { } func testPoundAssert5() { - AssertParse( + assertParse( """ func unbalanced1() { #assertℹ️(true 1️⃣ @@ -73,7 +73,7 @@ final class PoundAssertTests: XCTestCase { } func testPoundAssert6() { - AssertParse( + assertParse( #""" func unbalanced2() { #assertℹ️(true, "hello world" 1️⃣ diff --git a/Tests/SwiftParserTest/translated/RawStringErrorsTests.swift b/Tests/SwiftParserTest/translated/RawStringErrorsTests.swift index cb9879840c1..b960effa541 100644 --- a/Tests/SwiftParserTest/translated/RawStringErrorsTests.swift +++ b/Tests/SwiftParserTest/translated/RawStringErrorsTests.swift @@ -16,7 +16,7 @@ import XCTest final class RawStringErrorsTests: XCTestCase { func testRawStringErrors1() { - AssertParse( + assertParse( ###""" let _ = "foo\(#"bar"#1️⃣#)baz" """###, @@ -27,7 +27,7 @@ final class RawStringErrorsTests: XCTestCase { } func testRawStringErrors2() { - AssertParse( + assertParse( ###""" let _ = #"\#1️⃣#("invalid")"# """###, @@ -41,7 +41,7 @@ final class RawStringErrorsTests: XCTestCase { } func testRawStringErrors3() { - AssertParse( + assertParse( #####""" let _ = ###"""invalid"###1️⃣### """#####, @@ -55,7 +55,7 @@ final class RawStringErrorsTests: XCTestCase { } func testRawStringErrors4() { - AssertParse( + assertParse( #####""" let _ = ####"invalid"###1️⃣ """#####, @@ -66,7 +66,7 @@ final class RawStringErrorsTests: XCTestCase { } func testRawStringErrors5() { - AssertParse( + assertParse( #####""" let _ = ###"invalid"###1️⃣### """#####, @@ -77,7 +77,7 @@ final class RawStringErrorsTests: XCTestCase { } func testRawStringErrors6() { - AssertParse( + assertParse( ###""" let _ = ##"""1️⃣aa foobar @@ -98,7 +98,7 @@ final class RawStringErrorsTests: XCTestCase { } func testRawStringErrors7() { - AssertParse( + assertParse( ##""" let _ = #"""1️⃣ foo "bar" #baz """# @@ -115,7 +115,7 @@ final class RawStringErrorsTests: XCTestCase { } func testRawStringErrors8() { - AssertParse( + assertParse( ####""" let _ = ###"""1️⃣ "# "## """### diff --git a/Tests/SwiftParserTest/translated/RawStringTests.swift b/Tests/SwiftParserTest/translated/RawStringTests.swift index 005205f87a9..5dee0c26c06 100644 --- a/Tests/SwiftParserTest/translated/RawStringTests.swift +++ b/Tests/SwiftParserTest/translated/RawStringTests.swift @@ -16,7 +16,7 @@ import XCTest final class RawStringTests: XCTestCase { func testRawString1() { - AssertParse( + assertParse( """ import Swift """ @@ -24,7 +24,7 @@ final class RawStringTests: XCTestCase { } func testRawString2() { - AssertParse( + assertParse( ##""" _ = #""" ################################################################### @@ -36,7 +36,7 @@ final class RawStringTests: XCTestCase { } func testRawString3() { - AssertParse( + assertParse( ####""" _ = #""" # H1 # @@ -48,7 +48,7 @@ final class RawStringTests: XCTestCase { } func testRawString5() { - AssertParse( + assertParse( ###""" _ = ##""" One @@ -59,7 +59,7 @@ final class RawStringTests: XCTestCase { } func testRawString6() { - AssertParse( + assertParse( ###""" _ = ##""" Two @@ -70,7 +70,7 @@ final class RawStringTests: XCTestCase { } func testRawString7() { - AssertParse( + assertParse( ##""" _ = #""" Three\r @@ -81,7 +81,7 @@ final class RawStringTests: XCTestCase { } func testRawString8() { - AssertParse( + assertParse( ####""" _ = ###""" Four \(foo) @@ -92,7 +92,7 @@ final class RawStringTests: XCTestCase { } func testRawString9() { - AssertParse( + assertParse( ###""" _ = ##""" print(""" @@ -104,7 +104,7 @@ final class RawStringTests: XCTestCase { } func testRawString10() { - AssertParse( + assertParse( """ // ===---------- Single line --------=== """ @@ -112,7 +112,7 @@ final class RawStringTests: XCTestCase { } func testRawString11() { - AssertParse( + assertParse( ##""" _ = #""Zeta""# """## @@ -120,7 +120,7 @@ final class RawStringTests: XCTestCase { } func testRawString12() { - AssertParse( + assertParse( ##""" _ = #""Eta"\#n\#n\#n\#""# """## @@ -128,7 +128,7 @@ final class RawStringTests: XCTestCase { } func testRawString13() { - AssertParse( + assertParse( ##""" _ = #""Iota"\n\n\n\""# """## @@ -136,7 +136,7 @@ final class RawStringTests: XCTestCase { } func testRawString14() { - AssertParse( + assertParse( ##""" _ = #"a raw string with \" in it"# """## @@ -144,7 +144,7 @@ final class RawStringTests: XCTestCase { } func testRawString15() { - AssertParse( + assertParse( ###""" _ = ##""" a raw string with """ in it @@ -154,7 +154,7 @@ final class RawStringTests: XCTestCase { } func testRawString16() { - AssertParse( + assertParse( """ // ===---------- False Multiline Delimiters --------=== """ @@ -162,7 +162,7 @@ final class RawStringTests: XCTestCase { } func testRawString17() { - AssertParse( + assertParse( ##""" /// Source code contains zero-width character in this format: `#"[U+200B]"[U+200B]"#` /// The check contains zero-width character in this format: `"[U+200B]\"[U+200B]"` @@ -177,7 +177,7 @@ final class RawStringTests: XCTestCase { } func testRawString18() { - AssertParse( + assertParse( ##""" _ = #""""# """## @@ -185,7 +185,7 @@ final class RawStringTests: XCTestCase { } func testRawString19() { - AssertParse( + assertParse( ##""" _ = #"""""# """## @@ -193,7 +193,7 @@ final class RawStringTests: XCTestCase { } func testRawString20() { - AssertParse( + assertParse( ##""" _ = #""""""# """## @@ -201,7 +201,7 @@ final class RawStringTests: XCTestCase { } func testRawString21() { - AssertParse( + assertParse( ##""" _ = #"""# """## @@ -209,7 +209,7 @@ final class RawStringTests: XCTestCase { } func testRawString22() { - AssertParse( + assertParse( ###""" _ = ##""" foo # "# "## """### @@ -217,7 +217,7 @@ final class RawStringTests: XCTestCase { } func testRawString23() { - AssertParse( + assertParse( ####""" _ = ###""" "# "## "### """#### @@ -225,7 +225,7 @@ final class RawStringTests: XCTestCase { } func testRawString24() { - AssertParse( + assertParse( ####""" _ = ###"""##"### """#### @@ -233,7 +233,7 @@ final class RawStringTests: XCTestCase { } func testRawString25() { - AssertParse( + assertParse( ##""" _ = "interpolating \(#"""false delimiter"#)" """## @@ -241,7 +241,7 @@ final class RawStringTests: XCTestCase { } func testRawString26() { - AssertParse( + assertParse( ##""" _ = """ interpolating \(#"""false delimiters"""#) @@ -251,7 +251,7 @@ final class RawStringTests: XCTestCase { } func testRawString27() { - AssertParse( + assertParse( ##""" let foo = "Interpolation" _ = #"\b\b \#(foo)\#(foo) Kappa"# @@ -260,7 +260,7 @@ final class RawStringTests: XCTestCase { } func testRawString28() { - AssertParse( + assertParse( ###""" _ = """ interpolating \(##""" @@ -272,7 +272,7 @@ final class RawStringTests: XCTestCase { } func testRawString30() { - AssertParse( + assertParse( ##""" #"unused literal"# """## @@ -280,7 +280,7 @@ final class RawStringTests: XCTestCase { } func testRawString32() { - AssertParse( + assertParse( ##""" _ = #"This is a string"# """## @@ -288,7 +288,7 @@ final class RawStringTests: XCTestCase { } func testRawString33() { - AssertParse( + assertParse( ######""" _ = #####"This is a string"##### """###### @@ -296,7 +296,7 @@ final class RawStringTests: XCTestCase { } func testRawString34() { - AssertParse( + assertParse( ###""" _ = #"enum\s+.+\{.*case\s+[:upper:]"# _ = #"Alice: "How long is forever?" White Rabbit: "Sometimes, just one second.""# diff --git a/Tests/SwiftParserTest/translated/RecoveryLibraryTests.swift b/Tests/SwiftParserTest/translated/RecoveryLibraryTests.swift index 45f4562e591..3b2bdc2345b 100644 --- a/Tests/SwiftParserTest/translated/RecoveryLibraryTests.swift +++ b/Tests/SwiftParserTest/translated/RecoveryLibraryTests.swift @@ -16,7 +16,7 @@ import XCTest final class RecoveryLibraryTests: XCTestCase { func testRecoveryLibrary() { - AssertParse( + assertParse( """ // Check that we handle multiple consecutive right braces. 1️⃣} diff --git a/Tests/SwiftParserTest/translated/RecoveryTests.swift b/Tests/SwiftParserTest/translated/RecoveryTests.swift index b251ac9bbc0..8c5063486db 100644 --- a/Tests/SwiftParserTest/translated/RecoveryTests.swift +++ b/Tests/SwiftParserTest/translated/RecoveryTests.swift @@ -4,7 +4,7 @@ import XCTest final class RecoveryTests: XCTestCase { func testRecovery1() { - AssertParse( + assertParse( """ //===--- Helper types used in this file. """ @@ -12,7 +12,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery2() { - AssertParse( + assertParse( """ protocol FooProtocol {} """ @@ -20,7 +20,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery3() { - AssertParse( + assertParse( """ //===--- Tests. """ @@ -28,7 +28,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery4() { - AssertParse( + assertParse( #""" func garbage() -> () { var a : Int @@ -43,7 +43,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery5() { - AssertParse( + assertParse( #""" func moreGarbage() -> () { 1️⃣) this line is invalid, but we will stop at the declaration... @@ -58,7 +58,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery6() { - AssertParse( + assertParse( """ class Container { func exists() -> Bool { return true } @@ -68,7 +68,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery7() { - AssertParse( + assertParse( """ func useContainer() -> () { var a : Container] >4️⃣, b : Int @@ -87,7 +87,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery8() { - AssertParse( + assertParse( """ @xyz class BadAttributes { func exists() -> Bool { return true } @@ -97,7 +97,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery9() { - AssertParse( + assertParse( """ func test(a: BadAttributes) -> () { _ = a.exists() // no-warning @@ -107,7 +107,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery10() { - AssertParse( + assertParse( """ // Here is an extra random close-brace! 1️⃣} @@ -124,7 +124,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery11() { - AssertParse( + assertParse( """ func braceStmt2() { { () in braceStmt2(); } @@ -134,7 +134,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery12() { - AssertParse( + assertParse( """ func braceStmt3() { { @@ -146,7 +146,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery13() { - AssertParse( + assertParse( """ //===--- Recovery for misplaced 'static'. static func toplevelStaticFunc() {} @@ -162,7 +162,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery13b() { - AssertParse( + assertParse( """ if1️⃣ """, @@ -173,7 +173,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery14() { - AssertParse( + assertParse( """ if { }1️⃣ @@ -186,7 +186,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery15() { - AssertParse( + assertParse( """ if { @@ -200,7 +200,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery16() { - AssertParse( + assertParse( """ if true { } else if { @@ -216,7 +216,7 @@ final class RecoveryTests: XCTestCase { func testRecovery17() { // It is debatable if we should do recovery here and parse { true } as the // body, but the error message should be sensible. - AssertParse( + assertParse( """ if { true } { } @@ -232,7 +232,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery18() { - AssertParse( + assertParse( """ if { true }() { } @@ -244,7 +244,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery19() { - AssertParse( + assertParse( """ // if { { } }1️⃣ @@ -259,7 +259,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery20() { - AssertParse( + assertParse( """ while1️⃣ """, @@ -270,7 +270,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery21() { - AssertParse( + assertParse( """ while { }1️⃣ @@ -283,7 +283,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery22() { - AssertParse( + assertParse( """ while { @@ -297,7 +297,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery23() { - AssertParse( + assertParse( """ // It is debatable if we should do recovery here and parse { true } as the // body, but the error message should be sensible. @@ -315,7 +315,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery24() { - AssertParse( + assertParse( """ while { true }() { // expected-error 2 {{consecutive statements on a line must be separated by ';'}} expected-error {{closure expression is unused}} expected-note {{did you mean to use a 'do' statement?}} {{20-20=do }} expected-warning {{boolean literal is unused}} } @@ -327,7 +327,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery25() { - AssertParse( + assertParse( """ // while { { } }1️⃣ @@ -342,7 +342,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery26() { - AssertParse( + assertParse( """ repeat { } while1️⃣ @@ -354,7 +354,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery27() { - AssertParse( + assertParse( """ { missingControllingExprInRepeatWhile(); @@ -364,7 +364,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery28() { - AssertParse( + assertParse( """ repeat { } while { true }() @@ -379,7 +379,7 @@ final class RecoveryTests: XCTestCase { func testRecovery29() { // https://github.com/apple/swift/issues/42787 - AssertParse( + assertParse( """ repeat { }1️⃣ @@ -391,7 +391,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery30() { - AssertParse( + assertParse( """ for 1️⃣; { } @@ -404,7 +404,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery31() { - AssertParse( + assertParse( """ for 1️⃣; { @@ -418,7 +418,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery32() { - AssertParse( + assertParse( """ for 1️⃣; true { } @@ -431,7 +431,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery33() { - AssertParse( + assertParse( """ for var i 1️⃣= 0; true { i += 1 @@ -445,7 +445,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery34() { - AssertParse( + assertParse( """ for1️⃣ """, @@ -456,7 +456,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery35() { - AssertParse( + assertParse( """ for 1️⃣{ }2️⃣ @@ -471,7 +471,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery36() { - AssertParse( + assertParse( """ for1️⃣ { @@ -486,7 +486,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery37() { - AssertParse( + assertParse( """ for i 1️⃣{ }2️⃣ @@ -500,7 +500,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery38() { - AssertParse( + assertParse( """ for var i 1️⃣{ }2️⃣ @@ -514,7 +514,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery39() { - AssertParse( + assertParse( """ for 1️⃣in 2️⃣{ }3️⃣ @@ -530,7 +530,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery40() { - AssertParse( + assertParse( """ for 1️⃣0..<12 { } @@ -542,7 +542,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery41() { - AssertParse( + assertParse( """ for 1️⃣for in { }2️⃣ @@ -555,7 +555,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery42() { - AssertParse( + assertParse( """ for i in { }1️⃣ @@ -568,7 +568,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery43() { - AssertParse( + assertParse( """ // https://github.com/apple/swift/issues/48502 struct User { let name: String? } @@ -577,7 +577,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery44() { - AssertParse( + assertParse( #""" let users = [User]() for user in users 1️⃣whe { @@ -593,7 +593,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery45a() { - AssertParse( + assertParse( """ for 1️⃣ 2️⃣; @@ -608,7 +608,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery45b() { - AssertParse( + assertParse( """ switch1️⃣ """, @@ -619,7 +619,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery46() { - AssertParse( + assertParse( """ switch { }1️⃣ @@ -633,7 +633,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery47() { - AssertParse( + assertParse( """ switch { @@ -648,7 +648,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery48() { - AssertParse( + assertParse( """ switch { 1️⃣case _: return @@ -663,7 +663,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery49() { - AssertParse( + assertParse( """ switch { 1️⃣case Int: return @@ -681,7 +681,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery50() { - AssertParse( + assertParse( """ switch { 42 } { case _: return @@ -691,7 +691,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery51() { - AssertParse( + assertParse( """ switch { 42 }() { case _: return @@ -702,7 +702,7 @@ final class RecoveryTests: XCTestCase { //===--- Recovery for missing braces in nominal type decls. func testRecovery54() { - AssertParse( + assertParse( """ struct NoBracesStruct11️⃣() """, @@ -713,7 +713,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery55() { - AssertParse( + assertParse( """ enum NoBracesUnion11️⃣() class NoBracesClass12️⃣() @@ -736,7 +736,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery56() { - AssertParse( + assertParse( """ struct NoBracesStruct2 1️⃣ enum NoBracesUnion2 2️⃣ @@ -760,7 +760,7 @@ final class RecoveryTests: XCTestCase { //===--- Recovery for multiple identifiers in decls func testRecovery58() { - AssertParse( + assertParse( """ protocol Multi 1️⃣ident {} """, @@ -771,7 +771,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery60() { - AssertParse( + assertParse( """ class CCC 1️⃣CCC {} """, @@ -785,7 +785,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery62() { - AssertParse( + assertParse( """ enum EE 1️⃣EE where T : Multi { case a2️⃣ 3️⃣a @@ -801,7 +801,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery63() { - AssertParse( + assertParse( #""" struct SS 1️⃣SS : Multi { private var a 2️⃣b 3️⃣: Int = "" @@ -822,7 +822,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery64() { - AssertParse( + assertParse( """ let (efg 1️⃣hij, foobar) = (5, 6) """, @@ -834,7 +834,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery65() { - AssertParse( + assertParse( """ _ = foobar // OK. """ @@ -844,7 +844,7 @@ final class RecoveryTests: XCTestCase { //===--- Recovery for parse errors in types. func testRecovery67() { - AssertParse( + assertParse( """ struct ErrorTypeInVarDecl1 { var v1 : 1️⃣ @@ -857,7 +857,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery68() { - AssertParse( + assertParse( """ struct ErrorTypeInVarDecl2 { var v1 : Int.1️⃣ @@ -871,7 +871,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery69() { - AssertParse( + assertParse( """ struct ErrorTypeInVarDecl3 { var v1 : Int< 1️⃣ @@ -885,7 +885,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery70() { - AssertParse( + assertParse( """ struct ErrorTypeInVarDecl4 { var v1 : Int<1️⃣, @@ -899,7 +899,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery71() { - AssertParse( + assertParse( """ struct ErrorTypeInVarDecl5 { var v1 : Int 1️⃣ @@ -1103,7 +1103,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery98a() { - AssertParse( + assertParse( """ let a1: Swift.Int1️⃣] """, @@ -1114,7 +1114,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery98b() { - AssertParse( + assertParse( """ let a2: Set """, @@ -1126,7 +1126,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery98c() { - AssertParse( + assertParse( """ let a3: Set1️⃣] """, @@ -1138,7 +1138,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery98d() { - AssertParse( + assertParse( """ let a4: Int1️⃣]? """, @@ -1150,7 +1150,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery98e() { - AssertParse( + assertParse( """ let a5: Int?1️⃣] """, @@ -1162,7 +1162,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery98f() { - AssertParse( + assertParse( """ let a6: [Int]1️⃣] """, @@ -1174,7 +1174,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery98g() { - AssertParse( + assertParse( """ let a7: [String: Int]1️⃣] """, @@ -1186,7 +1186,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery99() { - AssertParse( + assertParse( """ struct ErrorTypeInVarDeclDictionaryType { let a1: String1️⃣: @@ -1210,7 +1210,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery100() { - AssertParse( + assertParse( """ struct ErrorInFunctionSignatureResultArrayType1 { func foo() -> Int1️⃣[ { @@ -1232,7 +1232,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery101() { - AssertParse( + assertParse( """ struct ErrorInFunctionSignatureResultArrayType2 { func foo() -> Int1️⃣[0 { @@ -1251,7 +1251,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery102() { - AssertParse( + assertParse( """ struct ErrorInFunctionSignatureResultArrayType3 { func foo() -> Int1️⃣[0] { @@ -1267,7 +1267,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery103() { - AssertParse( + assertParse( """ struct ErrorInFunctionSignatureResultArrayType4 { func foo() -> Int1️⃣[0_1] { @@ -1283,7 +1283,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery104() { - AssertParse( + assertParse( """ struct ErrorInFunctionSignatureResultArrayType5 { func foo() -> Int1️⃣[0b1] { @@ -1299,7 +1299,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery105() { - AssertParse( + assertParse( """ struct ErrorInFunctionSignatureResultArrayType11 { func foo() -> Int1️⃣[(a){a++}] { @@ -1314,7 +1314,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery106() { - AssertParse( + assertParse( """ //===--- Recovery for missing initial value in var decls. """ @@ -1322,7 +1322,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery107() { - AssertParse( + assertParse( """ struct MissingInitializer1 { var v1 : Int = 1️⃣ @@ -1335,7 +1335,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery108() { - AssertParse( + assertParse( """ //===--- Recovery for expr-postfix. """ @@ -1343,7 +1343,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery109() { - AssertParse( + assertParse( """ func exprPostfix1(x : Int) { x.1️⃣ @@ -1356,7 +1356,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery110() { - AssertParse( + assertParse( """ func exprPostfix2() { _ = .1️⃣42 @@ -1370,7 +1370,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery111() { - AssertParse( + assertParse( """ //===--- Recovery for expr-super. """ @@ -1378,7 +1378,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery112() { - AssertParse( + assertParse( """ class Base {} """ @@ -1386,7 +1386,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery113() { - AssertParse( + assertParse( """ class ExprSuper1 { init() { @@ -1398,7 +1398,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery114() { - AssertParse( + assertParse( """ class ExprSuper2 { init() { @@ -1413,7 +1413,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery115() { - AssertParse( + assertParse( """ //===--- Recovery for braces inside a nominal decl. """ @@ -1421,7 +1421,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery116() { - AssertParse( + assertParse( """ struct BracesInsideNominalDecl1 { 1️⃣{ @@ -1437,7 +1437,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery117() { - AssertParse( + assertParse( """ func use_BracesInsideNominalDecl1() { // Ensure that the typealias decl is not skipped. @@ -1448,7 +1448,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery118() { - AssertParse( + assertParse( #""" // https://github.com/apple/swift/issues/43383 class С_43383 { @@ -1464,7 +1464,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery119() { - AssertParse( + assertParse( #""" extension С_43383 { 1️⃣print(2️⃣"The room where it happened, the room where it happened") @@ -1479,7 +1479,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery120() { - AssertParse( + assertParse( """ //===--- Recovery for wrong decl introducer keyword. """ @@ -1487,7 +1487,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery121() { - AssertParse( + assertParse( """ class WrongDeclIntroducerKeyword1 { 1️⃣notAKeyword() {} @@ -1503,7 +1503,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery122() { - AssertParse( + assertParse( """ //===--- Recovery for wrong inheritance clause. """ @@ -1511,7 +1511,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery123() { - AssertParse( + assertParse( """ class Base2 { } @@ -1520,7 +1520,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery124() { - AssertParse( + assertParse( """ class SubModule { class Base1 {} @@ -1531,7 +1531,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery125() { - AssertParse( + assertParse( """ class WrongInheritanceClause11️⃣(Int) {} """, @@ -1543,7 +1543,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery126() { - AssertParse( + assertParse( """ class WrongInheritanceClause21️⃣(Base2) {} """, @@ -1555,7 +1555,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery127() { - AssertParse( + assertParse( """ class WrongInheritanceClause31️⃣(SubModule.Base1) where T:AnyObject {} """, @@ -1567,7 +1567,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery128() { - AssertParse( + assertParse( """ class WrongInheritanceClause41️⃣(SubModule.Base2) {} """, @@ -1579,7 +1579,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery129() { - AssertParse( + assertParse( """ class WrongInheritanceClause51️⃣(SubModule.Base2) where T:AnyObject {} """, @@ -1591,7 +1591,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery130() { - AssertParse( + assertParse( """ class WrongInheritanceClause61️⃣(Int 2️⃣{}3️⃣ """, @@ -1606,7 +1606,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery131() { - AssertParse( + assertParse( """ class WrongInheritanceClause71️⃣(Int 2️⃣where T:AnyObject {} """, @@ -1622,7 +1622,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery132() { - AssertParse( + assertParse( """ // [swift-crashes 078] parser crash on invalid cast in sequence expr Base=1 as Base=1 @@ -1631,7 +1631,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery133() { - AssertParse( + assertParse( #""" // Parser hangs at swift::Parser::parseType public enum TestA { @@ -1646,7 +1646,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery134() { - AssertParse( + assertParse( #""" public enum TestB { public static func convertFromExtenndition( @@ -1660,7 +1660,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery135() { - AssertParse( + assertParse( """ // Infinite loop and unbounded memory consumption in parser class bar {} @@ -1669,7 +1669,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery136() { - AssertParse( + assertParse( """ var baz: bar func foo1(bar!=baz) {} @@ -1681,7 +1681,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery137() { - AssertParse( + assertParse( """ func foo2(bar! = baz) {} """, @@ -1692,7 +1692,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery138() { - AssertParse( + assertParse( """ // rdar://19605567 switch esp { @@ -1709,7 +1709,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery141() { - AssertParse( + assertParse( """ #if true // rdar://19605164 @@ -1729,7 +1729,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery143() { - AssertParse( + assertParse( """ // rdar://19605567 func F() { init<1️⃣( 2️⃣} 3️⃣)} @@ -1747,7 +1747,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery144() { - AssertParse( + assertParse( """ init 1️⃣a(b: Int) {} """, @@ -1761,7 +1761,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery145() { - AssertParse( + assertParse( """ init? 1️⃣c(_ d: Int) {} """, @@ -1775,7 +1775,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery146() { - AssertParse( + assertParse( """ init 1️⃣e(f: T) {} """, @@ -1789,7 +1789,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery147() { - AssertParse( + assertParse( """ init? 1️⃣g(_: T) {} """, @@ -1803,7 +1803,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery148() { - AssertParse( + assertParse( """ init 1️⃣c d: Int 2️⃣{} """, @@ -1815,7 +1815,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery150() { - AssertParse( + assertParse( """ let n 1️⃣== C { get {} } @@ -1827,7 +1827,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery151() { - AssertParse( + assertParse( #""" // QoI: Nonsensical error and fixit if "let" is missing between 'if let ... where' clauses if let y = x 1️⃣where y == 0, let z = x { @@ -1845,7 +1845,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery152() { - AssertParse( + assertParse( """ if var y = x, y == 0, var z = x { z = y; y = z @@ -1855,7 +1855,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery153() { - AssertParse( + assertParse( """ if var y = x, z = x { z = y; y = z @@ -1868,7 +1868,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery154() { - AssertParse( + assertParse( #""" // QoI: Following a "let" condition with boolean condition spouts nonsensical errors guard let x: Int? = 1, x == 1 else { } @@ -1877,7 +1877,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery156() { - AssertParse( + assertParse( """ // rdar://20866942 func testRefutableLet() { @@ -1892,7 +1892,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery157() { - AssertParse( + assertParse( #""" // QoI: Bad error message when using Objective-C literals (@"Hello") in Swift files let myString = 1️⃣@"foo" @@ -1907,7 +1907,7 @@ final class RecoveryTests: XCTestCase { func testRecovery158() { // support curly quotes for string literals - AssertParse( + assertParse( """ let curlyQuotes1 = 1️⃣“hello world!” """, @@ -1921,7 +1921,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery159() { - AssertParse( + assertParse( #""" let curlyQuotes2 = 1️⃣“hello world!" """#, @@ -1936,7 +1936,7 @@ final class RecoveryTests: XCTestCase { func testRecovery160() { // compiler should recover better from "unicode Specials" characters - AssertParse( + assertParse( #""" let 1️⃣tryx = 123 """#, @@ -1947,7 +1947,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery161() { - AssertParse( + assertParse( """ // Malformed Swift Enums crash playground service enum Rank: Int { @@ -1959,7 +1959,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery162() { - AssertParse( + assertParse( """ // rdar://22240342 - Crash in diagRecursivePropertyAccess class r22240342 { @@ -1976,7 +1976,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery163() { - AssertParse( + assertParse( """ // QoI: Common errors: 'let x= 5' and 'let x =5' could use Fix-its func r22387625() { @@ -1992,7 +1992,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery164() { - AssertParse( + assertParse( """ // https://github.com/apple/swift/issues/45723 do { @@ -2008,7 +2008,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery165() { - AssertParse( + assertParse( """ // Swift compiler crash in CSDiag protocol A23086402 { @@ -2019,7 +2019,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery166() { - AssertParse( + assertParse( """ protocol B23086402 { var c: [String] { get } @@ -2029,7 +2029,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery167() { - AssertParse( + assertParse( #""" func test23086402(a: A23086402) { print(a.b.c + "") // should not crash but: expected-error {{}} @@ -2039,7 +2039,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery168() { - AssertParse( + assertParse( #""" // QoI: Poor diagnostic in argument list of "print" (varargs related) // The situation has changed. String now conforms to the RangeReplaceableCollection protocol @@ -2053,7 +2053,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery169() { - AssertParse( + assertParse( """ // [practicalswift] Compiler crashes on &(Int:_) func test23719432() { @@ -2068,7 +2068,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery170() { - AssertParse( + assertParse( """ // QoI: terrible recovery when using '·' for an operator infix operator 1️⃣· 2️⃣{ @@ -2085,7 +2085,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery171() { - AssertParse( + assertParse( """ infix operator -1️⃣@-class Recover1 {} """, @@ -2096,7 +2096,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery172() { - AssertParse( + assertParse( """ prefix operator -1️⃣фф--class Recover2 {} """, @@ -2107,7 +2107,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery173() { - AssertParse( + assertParse( #""" // Swift Compiler bug: String subscripts with range should require closing bracket. func r21712891(s : String) -> String { @@ -2124,7 +2124,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery174() { - AssertParse( + assertParse( #""" // "Postfix '.' is reserved" error message" isn't helpful func postfixDot(a : String) { @@ -2143,7 +2143,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery175() { - AssertParse( + assertParse( #""" // QoI: "UIColor." gives two issues, should only give one func f() { // expected-note 2{{did you mean 'f'?}} @@ -2157,7 +2157,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery176() { - AssertParse( + assertParse( """ // rdar://problem/22478168 // https://github.com/apple/swift/issues/53396 @@ -2171,7 +2171,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery177() { - AssertParse( + assertParse( """ // rdar://38225184 extension Collection where Element == Int 1️⃣&& Index == Int {} @@ -2184,7 +2184,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery179() { - AssertParse( + assertParse( """ func testSkipUnbalancedParen() {1️⃣ 2️⃣?( @@ -2198,7 +2198,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery180() { - AssertParse( + assertParse( """ func testSkipToFindOpenBrace1() { do { if case 1️⃣} @@ -2213,7 +2213,7 @@ final class RecoveryTests: XCTestCase { } func testRecovery181() { - AssertParse( + assertParse( """ func testSkipToFindOpenBrace2() { do { if true {} else 1️⃣false } @@ -2228,14 +2228,14 @@ final class RecoveryTests: XCTestCase { } func testRecovery182() { - AssertParse( + assertParse( "func foo() 1️⃣bogus {}", diagnostics: [ DiagnosticSpec(message: "unexpected code 'bogus' in function") ] ) - AssertParse( + assertParse( "func foo() 1️⃣bogus -> Int {}", diagnostics: [ DiagnosticSpec(message: "unexpected code 'bogus' in function signature") diff --git a/Tests/SwiftParserTest/translated/ResultBuilderTests.swift b/Tests/SwiftParserTest/translated/ResultBuilderTests.swift index 92e7703fe06..bc2d25d8bf3 100644 --- a/Tests/SwiftParserTest/translated/ResultBuilderTests.swift +++ b/Tests/SwiftParserTest/translated/ResultBuilderTests.swift @@ -16,7 +16,7 @@ import XCTest final class ResultBuilderTests: XCTestCase { func testResultBuilder1() { - AssertParse( + assertParse( """ // rdar://70158735 """ @@ -24,7 +24,7 @@ final class ResultBuilderTests: XCTestCase { } func testResultBuilder2() { - AssertParse( + assertParse( """ @resultBuilder struct A { @@ -35,7 +35,7 @@ final class ResultBuilderTests: XCTestCase { } func testResultBuilder3() { - AssertParse( + assertParse( """ struct B {} """ @@ -43,7 +43,7 @@ final class ResultBuilderTests: XCTestCase { } func testResultBuilder4() { - AssertParse( + assertParse( """ extension B { @resultBuilder @@ -60,7 +60,7 @@ final class ResultBuilderTests: XCTestCase { } func testResultBuilder5() { - AssertParse( + assertParse( """ @A var test0: Int { 1 @@ -72,7 +72,7 @@ final class ResultBuilderTests: XCTestCase { } func testResultBuilder6() { - AssertParse( + assertParse( """ @B.NonGeneric var test1: Int { 1 @@ -84,7 +84,7 @@ final class ResultBuilderTests: XCTestCase { } func testResultBuilder7() { - AssertParse( + assertParse( """ @B.Generic var test2: Int { 1 diff --git a/Tests/SwiftParserTest/translated/SelfRebindingTests.swift b/Tests/SwiftParserTest/translated/SelfRebindingTests.swift index f18913eacf7..92d982221ec 100644 --- a/Tests/SwiftParserTest/translated/SelfRebindingTests.swift +++ b/Tests/SwiftParserTest/translated/SelfRebindingTests.swift @@ -16,7 +16,7 @@ import XCTest final class SelfRebindingTests: XCTestCase { func testSelfRebinding1() { - AssertParse( + assertParse( #""" class Writer { private var articleWritten = 47 @@ -53,7 +53,7 @@ final class SelfRebindingTests: XCTestCase { } func testSelfRebinding2() { - AssertParse( + assertParse( """ struct T { var mutable: Int = 0 @@ -69,7 +69,7 @@ final class SelfRebindingTests: XCTestCase { } func testSelfRebinding3() { - AssertParse( + assertParse( """ class MyCls { func something() {} @@ -83,7 +83,7 @@ final class SelfRebindingTests: XCTestCase { } func testSelfRebinding4() { - AssertParse( + assertParse( """ // https://github.com/apple/swift/issues/47136 // Method called 'self' can be confused with regular 'self' @@ -92,7 +92,7 @@ final class SelfRebindingTests: XCTestCase { } func testSelfRebinding5() { - AssertParse( + assertParse( """ func funcThatReturnsSomething(_ any: Any) -> Any { any @@ -102,7 +102,7 @@ final class SelfRebindingTests: XCTestCase { } func testSelfRebinding6() { - AssertParse( + assertParse( """ struct TypeWithSelfMethod { let property = self @@ -121,7 +121,7 @@ final class SelfRebindingTests: XCTestCase { } func testSelfRebinding7() { - AssertParse( + assertParse( """ /// Test fix_unqualified_access_member_named_self doesn't appear for computed var called `self` /// it can't currently be referenced as a static member -- unlike a method with the same name @@ -140,7 +140,7 @@ final class SelfRebindingTests: XCTestCase { } func testSelfRebinding8() { - AssertParse( + assertParse( """ /// Test fix_unqualified_access_member_named_self doesn't appear for property called `self` /// it can't currently be referenced as a static member -- unlike a method with the same name @@ -157,7 +157,7 @@ final class SelfRebindingTests: XCTestCase { } func testSelfRebinding9() { - AssertParse( + assertParse( """ enum EnumCaseNamedSelf { case `self` @@ -172,7 +172,7 @@ final class SelfRebindingTests: XCTestCase { } func testSelfRebinding10() { - AssertParse( + assertParse( """ // rdar://90624344 - warning about `self` which cannot be fixed because it's located in implicitly generated code. struct TestImplicitSelfUse : Codable { diff --git a/Tests/SwiftParserTest/translated/SemicolonTests.swift b/Tests/SwiftParserTest/translated/SemicolonTests.swift index b21b133d981..563f2ca5c96 100644 --- a/Tests/SwiftParserTest/translated/SemicolonTests.swift +++ b/Tests/SwiftParserTest/translated/SemicolonTests.swift @@ -16,7 +16,7 @@ import XCTest final class SemicolonTests: XCTestCase { func testSemicolon1() { - AssertParse( + assertParse( #""" let a = 42; var b = "b"; @@ -25,7 +25,7 @@ final class SemicolonTests: XCTestCase { } func testSemicolon2() { - AssertParse( + assertParse( """ struct A { var a1: Int; @@ -38,7 +38,7 @@ final class SemicolonTests: XCTestCase { } func testSemicolon3() { - AssertParse( + assertParse( """ enum B { case B1; @@ -51,7 +51,7 @@ final class SemicolonTests: XCTestCase { } func testSemicolon4() { - AssertParse( + assertParse( """ class C { var x: Int; @@ -63,7 +63,7 @@ final class SemicolonTests: XCTestCase { } func testSemicolon5() { - AssertParse( + assertParse( """ typealias C1 = C; """ @@ -71,7 +71,7 @@ final class SemicolonTests: XCTestCase { } func testSemicolon6() { - AssertParse( + assertParse( """ protocol D { var foo: () -> Int { get }; @@ -81,7 +81,7 @@ final class SemicolonTests: XCTestCase { } func testSemicolon7() { - AssertParse( + assertParse( """ struct D1: D { let foo = { return 42; }; @@ -94,7 +94,7 @@ final class SemicolonTests: XCTestCase { } func testSemicolon8() { - AssertParse( + assertParse( """ import Swift; """ @@ -102,7 +102,7 @@ final class SemicolonTests: XCTestCase { } func testSemicolon9() { - AssertParse( + assertParse( """ for i in 1..<1000 { if i % 2 == 1 { @@ -114,7 +114,7 @@ final class SemicolonTests: XCTestCase { } func testSemicolon10() { - AssertParse( + assertParse( """ let six = (1..<3).reduce(0, +); """ @@ -122,7 +122,7 @@ final class SemicolonTests: XCTestCase { } func testSemicolon11() { - AssertParse( + assertParse( """ func lessThanTwo(input: UInt) -> Bool { switch input { @@ -137,7 +137,7 @@ final class SemicolonTests: XCTestCase { } func testSemicolon12() { - AssertParse( + assertParse( """ enum StarWars { enum Quality { case 😀; case 🙂; case 😐; case 😏; case 😞 }; diff --git a/Tests/SwiftParserTest/translated/StringLiteralEofTests.swift b/Tests/SwiftParserTest/translated/StringLiteralEofTests.swift index ebb8400a855..45b4e5bb6c2 100644 --- a/Tests/SwiftParserTest/translated/StringLiteralEofTests.swift +++ b/Tests/SwiftParserTest/translated/StringLiteralEofTests.swift @@ -16,7 +16,7 @@ import XCTest final class StringLiteralEofTests: XCTestCase { func testStringLiteralEof1() { - AssertParse( + assertParse( ##""" // NOTE: DO NOT add a newline at EOF. _ = "foo\(1️⃣ @@ -29,7 +29,7 @@ final class StringLiteralEofTests: XCTestCase { } func testStringLiteralEof2() { - AssertParse( + assertParse( // NOTE: DO NOT add a newline at EOF. ##""" _ = 9️⃣"foo\8️⃣(7️⃣"bar1️⃣ @@ -46,7 +46,7 @@ final class StringLiteralEofTests: XCTestCase { } func testStringLiteralEof3() { - AssertParse( + assertParse( ##""" _ = "foo 1️⃣\2️⃣ """##, @@ -58,7 +58,7 @@ final class StringLiteralEofTests: XCTestCase { } func testStringLiteralEof4() { - AssertParse( + assertParse( ##""" // NOTE: DO NOT add a newline at EOF. _ = "foo 1️⃣\2️⃣ @@ -71,7 +71,7 @@ final class StringLiteralEofTests: XCTestCase { } func testStringLiteralEof5() { - AssertParse( + assertParse( #""" // NOTE: DO NOT add a newline at EOF. _ = """ @@ -85,7 +85,7 @@ final class StringLiteralEofTests: XCTestCase { func testStringLiteralEof6() { // NOTE: DO NOT add a newline at EOF. - AssertParse( + assertParse( ##""" _ = """ foo @@ -106,7 +106,7 @@ final class StringLiteralEofTests: XCTestCase { func testStringLiteralEof7() { // NOTE: DO NOT add a newline at EOF. - AssertParse( + assertParse( ##""" _ = """ foo @@ -121,7 +121,7 @@ final class StringLiteralEofTests: XCTestCase { } func testStringLiteralEof8() { - AssertParse( + assertParse( ##""" _ = """ \("bar1️⃣ diff --git a/Tests/SwiftParserTest/translated/SubscriptingTests.swift b/Tests/SwiftParserTest/translated/SubscriptingTests.swift index 67b50522c15..a0a98cdadc7 100644 --- a/Tests/SwiftParserTest/translated/SubscriptingTests.swift +++ b/Tests/SwiftParserTest/translated/SubscriptingTests.swift @@ -16,7 +16,7 @@ import XCTest final class SubscriptingTests: XCTestCase { func testSubscripting1() { - AssertParse( + assertParse( """ struct X { } """ @@ -24,7 +24,7 @@ final class SubscriptingTests: XCTestCase { } func testSubscripting2() { - AssertParse( + assertParse( """ // Simple examples struct X1 { @@ -44,7 +44,7 @@ final class SubscriptingTests: XCTestCase { } func testSubscripting3() { - AssertParse( + assertParse( """ struct X2 { var stored: Int @@ -62,7 +62,7 @@ final class SubscriptingTests: XCTestCase { } func testSubscripting4() { - AssertParse( + assertParse( """ struct X3 { var stored: Int @@ -80,7 +80,7 @@ final class SubscriptingTests: XCTestCase { } func testSubscripting5() { - AssertParse( + assertParse( """ struct X4 { var stored: Int @@ -99,7 +99,7 @@ final class SubscriptingTests: XCTestCase { } func testSubscripting6() { - AssertParse( + assertParse( """ struct X5 { static var stored: Int = 1 @@ -117,7 +117,7 @@ final class SubscriptingTests: XCTestCase { } func testSubscripting7() { - AssertParse( + assertParse( """ class X6 { static var stored: Int = 1 @@ -135,7 +135,7 @@ final class SubscriptingTests: XCTestCase { } func testSubscripting8() { - AssertParse( + assertParse( """ struct Y1 { var stored: Int @@ -153,7 +153,7 @@ final class SubscriptingTests: XCTestCase { } func testSubscripting9() { - AssertParse( + assertParse( """ // Mutating getters on constants // https://github.com/apple/swift/issues/43457 @@ -162,7 +162,7 @@ final class SubscriptingTests: XCTestCase { } func testSubscripting10() { - AssertParse( + assertParse( """ struct Y2 { subscript(_: Int) -> Int { @@ -174,7 +174,7 @@ final class SubscriptingTests: XCTestCase { } func testSubscripting11() { - AssertParse( + assertParse( """ // FIXME: This test case does not belong in Parse/ let y2 = Y2() @@ -184,7 +184,7 @@ final class SubscriptingTests: XCTestCase { } func testSubscripting12a() { - AssertParse( + assertParse( """ struct A0 { subscript 1️⃣ @@ -224,7 +224,7 @@ final class SubscriptingTests: XCTestCase { } func testSubscripting12b() { - AssertParse( + assertParse( """ // Parsing errors struct A0 { @@ -240,7 +240,7 @@ final class SubscriptingTests: XCTestCase { } func testSubscripting13() { - AssertParse( + assertParse( """ struct A1 { subscript (i : Int) 1️⃣ @@ -261,7 +261,7 @@ final class SubscriptingTests: XCTestCase { } func testSubscripting14() { - AssertParse( + assertParse( """ struct A2 { subscript (i : Int) -> 1️⃣ @@ -282,7 +282,7 @@ final class SubscriptingTests: XCTestCase { } func testSubscripting15() { - AssertParse( + assertParse( """ struct A3 { subscript(i : Int) 1️⃣ @@ -300,7 +300,7 @@ final class SubscriptingTests: XCTestCase { } func testSubscripting16() { - AssertParse( + assertParse( """ struct A4 { subscript(i : Int) 1️⃣{ @@ -317,7 +317,7 @@ final class SubscriptingTests: XCTestCase { } func testSubscripting17() { - AssertParse( + assertParse( """ struct A5 { subscript(i : Int) -> Int @@ -327,7 +327,7 @@ final class SubscriptingTests: XCTestCase { } func testSubscripting18() { - AssertParse( + assertParse( """ struct A6 { subscript(i: Int)1️⃣(j: Int) -> Int { @@ -344,7 +344,7 @@ final class SubscriptingTests: XCTestCase { } func testSubscripting19() { - AssertParse( + assertParse( """ struct A7 { class subscript(a: Float) -> Int { @@ -358,7 +358,7 @@ final class SubscriptingTests: XCTestCase { } func testSubscripting20() { - AssertParse( + assertParse( """ class A7b { class static subscript(a: Float) -> Int { @@ -372,7 +372,7 @@ final class SubscriptingTests: XCTestCase { } func testSubscripting21() { - AssertParse( + assertParse( """ struct A8 { subscript(i : Int) -> Int1️⃣ @@ -392,7 +392,7 @@ final class SubscriptingTests: XCTestCase { } func testSubscripting22() { - AssertParse( + assertParse( """ struct A9 { subscript 1️⃣x() -> Int { @@ -414,7 +414,7 @@ final class SubscriptingTests: XCTestCase { } func testSubscripting23() { - AssertParse( + assertParse( """ struct A10 { subscript 1️⃣x(i: Int) -> Int { @@ -443,7 +443,7 @@ final class SubscriptingTests: XCTestCase { } func testSubscripting24() { - AssertParse( + assertParse( """ struct A11 { subscript 1️⃣x y : 2️⃣Int 3️⃣-> Int 4️⃣{ diff --git a/Tests/SwiftParserTest/translated/SuperTests.swift b/Tests/SwiftParserTest/translated/SuperTests.swift index 97d169c73ed..e0e28909f44 100644 --- a/Tests/SwiftParserTest/translated/SuperTests.swift +++ b/Tests/SwiftParserTest/translated/SuperTests.swift @@ -17,7 +17,7 @@ import XCTest final class SuperTests: XCTestCase { func testSuper1() { - AssertParse( + assertParse( """ class B { var foo: Int @@ -34,7 +34,7 @@ final class SuperTests: XCTestCase { } func testSuper2a() { - AssertParse( + assertParse( #""" class D : B { override init() { @@ -47,7 +47,7 @@ final class SuperTests: XCTestCase { } func testSuper2b() { - AssertParse( + assertParse( #""" class D : B { override init(x:Int) { @@ -59,7 +59,7 @@ final class SuperTests: XCTestCase { } func testSuper2c() { - AssertParse( + assertParse( #""" class D : B { convenience init(y:Int) { @@ -71,7 +71,7 @@ final class SuperTests: XCTestCase { } func testSuper2d() { - AssertParse( + assertParse( #""" class D : B { init(z: Int) { @@ -84,7 +84,7 @@ final class SuperTests: XCTestCase { } func testSuper2e() { - AssertParse( + assertParse( #""" class D : B { func super_calls() { @@ -106,7 +106,7 @@ final class SuperTests: XCTestCase { } func testSuper2f() { - AssertParse( + assertParse( #""" class D : B { func bad_super_1() { @@ -121,7 +121,7 @@ final class SuperTests: XCTestCase { } func testSuper2g() { - AssertParse( + assertParse( #""" class D : B { func bad_super_2() { @@ -145,7 +145,7 @@ final class SuperTests: XCTestCase { } func testSuper2h() { - AssertParse( + assertParse( #""" class D : B { func bad_super_3() { @@ -169,7 +169,7 @@ final class SuperTests: XCTestCase { } func testSuper3() { - AssertParse( + assertParse( """ class Closures : B { func captureWeak() { diff --git a/Tests/SwiftParserTest/translated/SwitchIncompleteTests.swift b/Tests/SwiftParserTest/translated/SwitchIncompleteTests.swift index 0d4a494d394..eff89918f51 100644 --- a/Tests/SwiftParserTest/translated/SwitchIncompleteTests.swift +++ b/Tests/SwiftParserTest/translated/SwitchIncompleteTests.swift @@ -16,7 +16,7 @@ import XCTest final class SwitchIncompleteTests: XCTestCase { func testSwitchIncomplete1() { - AssertParse( + assertParse( """ // Incomplete switch was parsing to an AST that // triggered an assertion failure. diff --git a/Tests/SwiftParserTest/translated/SwitchTests.swift b/Tests/SwiftParserTest/translated/SwitchTests.swift index 6a85a9cf2cd..5e6e2e1b120 100644 --- a/Tests/SwiftParserTest/translated/SwitchTests.swift +++ b/Tests/SwiftParserTest/translated/SwitchTests.swift @@ -16,7 +16,7 @@ import XCTest final class SwitchTests: XCTestCase { func testSwitch1() { - AssertParse( + assertParse( """ func ~= (x: (Int,Int), y: (Int,Int)) -> Bool { return true @@ -26,7 +26,7 @@ final class SwitchTests: XCTestCase { } func testSwitch2() { - AssertParse( + assertParse( """ func parseError1(x: Int) { switch 1️⃣func 2️⃣{} @@ -40,7 +40,7 @@ final class SwitchTests: XCTestCase { } func testSwitch3() { - AssertParse( + assertParse( """ func parseError2(x: Int) { switch x 1️⃣ @@ -53,7 +53,7 @@ final class SwitchTests: XCTestCase { } func testSwitch4() { - AssertParse( + assertParse( """ func parseError3(x: Int) { switch x { @@ -68,7 +68,7 @@ final class SwitchTests: XCTestCase { } func testSwitch5() { - AssertParse( + assertParse( """ func parseError4(x: Int) { switch x { @@ -84,7 +84,7 @@ final class SwitchTests: XCTestCase { } func testSwitch6() { - AssertParse( + assertParse( """ func parseError5(x: Int) { switch x { @@ -99,7 +99,7 @@ final class SwitchTests: XCTestCase { } func testSwitch7() { - AssertParse( + assertParse( """ func parseError6(x: Int) { switch x { @@ -114,7 +114,7 @@ final class SwitchTests: XCTestCase { } func testSwitch8() { - AssertParse( + assertParse( """ var x: Int """ @@ -122,7 +122,7 @@ final class SwitchTests: XCTestCase { } func testSwitch9() { - AssertParse( + assertParse( """ switch x {} """ @@ -130,7 +130,7 @@ final class SwitchTests: XCTestCase { } func testSwitch10() { - AssertParse( + assertParse( """ switch x { case 0: @@ -164,7 +164,7 @@ final class SwitchTests: XCTestCase { } func testSwitch11() { - AssertParse( + assertParse( """ // Multiple cases per case block switch x { @@ -177,7 +177,7 @@ final class SwitchTests: XCTestCase { } func testSwitch12() { - AssertParse( + assertParse( """ switch x { case 0: @@ -189,7 +189,7 @@ final class SwitchTests: XCTestCase { } func testSwitch13() { - AssertParse( + assertParse( """ switch x { case 0: @@ -201,7 +201,7 @@ final class SwitchTests: XCTestCase { } func testSwitch14() { - AssertParse( + assertParse( """ switch x { case 0: @@ -213,7 +213,7 @@ final class SwitchTests: XCTestCase { } func testSwitch15() { - AssertParse( + assertParse( """ switch x { case 0: @@ -237,7 +237,7 @@ final class SwitchTests: XCTestCase { } func testSwitch16a() { - AssertParse( + assertParse( """ switch x { 1️⃣x = 1 @@ -256,7 +256,7 @@ final class SwitchTests: XCTestCase { } func testSwitch16b() { - AssertParse( + assertParse( """ switch x { 1️⃣let x = 1 @@ -279,7 +279,7 @@ final class SwitchTests: XCTestCase { } func testSwitch17() { - AssertParse( + assertParse( """ switch x { default: @@ -292,7 +292,7 @@ final class SwitchTests: XCTestCase { } func testSwitch18() { - AssertParse( + assertParse( """ switch x { 1️⃣x = 1 @@ -305,7 +305,7 @@ final class SwitchTests: XCTestCase { } func testSwitch19() { - AssertParse( + assertParse( """ switch x { 1️⃣x = 1 @@ -319,7 +319,7 @@ final class SwitchTests: XCTestCase { } func testSwitch20() { - AssertParse( + assertParse( """ switch x { default: @@ -331,7 +331,7 @@ final class SwitchTests: XCTestCase { } func testSwitch21() { - AssertParse( + assertParse( """ switch x { default: @@ -343,7 +343,7 @@ final class SwitchTests: XCTestCase { } func testSwitch22() { - AssertParse( + assertParse( """ switch x { default 1️⃣where x == 0: @@ -357,7 +357,7 @@ final class SwitchTests: XCTestCase { } func testSwitch23() { - AssertParse( + assertParse( """ switch x { case 0: @@ -367,7 +367,7 @@ final class SwitchTests: XCTestCase { } func testSwitch24() { - AssertParse( + assertParse( """ switch x { case 0: @@ -379,7 +379,7 @@ final class SwitchTests: XCTestCase { } func testSwitch25() { - AssertParse( + assertParse( """ switch x { case 0: @@ -391,7 +391,7 @@ final class SwitchTests: XCTestCase { } func testSwitch26() { - AssertParse( + assertParse( """ 1️⃣case 0: var y = 0 @@ -406,7 +406,7 @@ final class SwitchTests: XCTestCase { } func testSwitch27() { - AssertParse( + assertParse( """ fallthrough """ @@ -414,7 +414,7 @@ final class SwitchTests: XCTestCase { } func testSwitch28() { - AssertParse( + assertParse( """ switch x { case 0: @@ -429,7 +429,7 @@ final class SwitchTests: XCTestCase { } func testSwitch29() { - AssertParse( + assertParse( """ // Fallthrough can transfer control anywhere within a case and can appear // multiple times in the same case. @@ -446,7 +446,7 @@ final class SwitchTests: XCTestCase { } func testSwitch30() { - AssertParse( + assertParse( """ // Cases cannot contain 'var' bindings if there are multiple matching patterns // attached to a block. They may however contain other non-binding patterns. @@ -455,7 +455,7 @@ final class SwitchTests: XCTestCase { } func testSwitch31() { - AssertParse( + assertParse( """ var t = (1, 2) """ @@ -463,7 +463,7 @@ final class SwitchTests: XCTestCase { } func testSwitch32() { - AssertParse( + assertParse( """ switch t { case (var a, 2), (1, _): @@ -501,7 +501,7 @@ final class SwitchTests: XCTestCase { } func testSwitch33() { - AssertParse( + assertParse( """ func patternVarUsedInAnotherPattern(x: Int) { switch x { @@ -515,7 +515,7 @@ final class SwitchTests: XCTestCase { } func testSwitch34() { - AssertParse( + assertParse( """ // Fallthroughs can only transfer control into a case label with bindings if the previous case binds a superset of those vars. switch t { @@ -529,7 +529,7 @@ final class SwitchTests: XCTestCase { } func testSwitch35() { - AssertParse( + assertParse( """ switch t { // specifically notice on next line that we shouldn't complain that a is unused - just never mutated case (var a, let b): @@ -543,7 +543,7 @@ final class SwitchTests: XCTestCase { } func testSwitch36() { - AssertParse( + assertParse( """ func patternVarDiffType(x: Int, y: Double) { switch (x, y) { @@ -558,7 +558,7 @@ final class SwitchTests: XCTestCase { } func testSwitch37() { - AssertParse( + assertParse( """ func patternVarDiffMutability(x: Int, y: Double) { switch x { @@ -584,7 +584,7 @@ final class SwitchTests: XCTestCase { } func testSwitch38() { - AssertParse( + assertParse( """ func test_label(x : Int) { Gronk: @@ -597,7 +597,7 @@ final class SwitchTests: XCTestCase { } func testSwitch39() { - AssertParse( + assertParse( """ func enumElementSyntaxOnTuple() { switch (1, 1) { @@ -612,7 +612,7 @@ final class SwitchTests: XCTestCase { } func testSwitch40() { - AssertParse( + assertParse( """ // https://github.com/apple/swift/issues/42798 enum Whatever { case Thing } @@ -627,7 +627,7 @@ final class SwitchTests: XCTestCase { } func testSwitch41() { - AssertParse( + assertParse( #""" // https://github.com/apple/swift/issues/43334 // https://github.com/apple/swift/issues/43335 @@ -666,7 +666,7 @@ final class SwitchTests: XCTestCase { } func testSwitch42() { - AssertParse( + assertParse( """ switch Whatever.Thing { case .Thing: @@ -678,7 +678,7 @@ final class SwitchTests: XCTestCase { } func testSwitch43() { - AssertParse( + assertParse( """ switch Whatever.Thing { case .Thing: @@ -690,7 +690,7 @@ final class SwitchTests: XCTestCase { } func testSwitch44() { - AssertParse( + assertParse( """ switch Whatever.Thing { case .Thing: @@ -702,7 +702,7 @@ final class SwitchTests: XCTestCase { } func testSwitch45() { - AssertParse( + assertParse( """ switch Whatever.Thing { case .Thing: @@ -714,7 +714,7 @@ final class SwitchTests: XCTestCase { } func testSwitch46() { - AssertParse( + assertParse( """ switch Whatever.Thing { @unknown default: @@ -729,7 +729,7 @@ final class SwitchTests: XCTestCase { } func testSwitch47() { - AssertParse( + assertParse( """ switch Whatever.Thing { default: @@ -744,7 +744,7 @@ final class SwitchTests: XCTestCase { } func testSwitch48() { - AssertParse( + assertParse( """ switch Whatever.Thing { default: @@ -759,7 +759,7 @@ final class SwitchTests: XCTestCase { } func testSwitch49() { - AssertParse( + assertParse( """ switch Whatever.Thing { @unknown default 1️⃣where x == 0: @@ -773,7 +773,7 @@ final class SwitchTests: XCTestCase { } func testSwitch50() { - AssertParse( + assertParse( """ switch Whatever.Thing { @unknown case _: @@ -784,7 +784,7 @@ final class SwitchTests: XCTestCase { } func testSwitch51() { - AssertParse( + assertParse( """ switch Whatever.Thing { @unknown case _: @@ -797,7 +797,7 @@ final class SwitchTests: XCTestCase { } func testSwitch52() { - AssertParse( + assertParse( """ switch Whatever.Thing { @unknown default: @@ -810,7 +810,7 @@ final class SwitchTests: XCTestCase { } func testSwitch53() { - AssertParse( + assertParse( """ switch Whatever.Thing { @unknown case _, _: @@ -821,7 +821,7 @@ final class SwitchTests: XCTestCase { } func testSwitch54() { - AssertParse( + assertParse( """ switch Whatever.Thing { @unknown case _, _, _: @@ -832,7 +832,7 @@ final class SwitchTests: XCTestCase { } func testSwitch55() { - AssertParse( + assertParse( """ switch Whatever.Thing { @unknown case let value: @@ -843,7 +843,7 @@ final class SwitchTests: XCTestCase { } func testSwitch56() { - AssertParse( + assertParse( """ switch (Whatever.Thing, Whatever.Thing) { @unknown case (_, _): @@ -854,7 +854,7 @@ final class SwitchTests: XCTestCase { } func testSwitch57() { - AssertParse( + assertParse( """ switch Whatever.Thing { @unknown case is Whatever: @@ -865,7 +865,7 @@ final class SwitchTests: XCTestCase { } func testSwitch58() { - AssertParse( + assertParse( """ switch Whatever.Thing { @unknown case .Thing: @@ -876,7 +876,7 @@ final class SwitchTests: XCTestCase { } func testSwitch59() { - AssertParse( + assertParse( """ switch Whatever.Thing { @unknown case (_): // okay @@ -887,7 +887,7 @@ final class SwitchTests: XCTestCase { } func testSwitch60() { - AssertParse( + assertParse( """ switch Whatever.Thing { @unknown case _ where x == 0: @@ -898,7 +898,7 @@ final class SwitchTests: XCTestCase { } func testSwitch61() { - AssertParse( + assertParse( """ switch Whatever.Thing { @unknown default 1️⃣where x == 0: @@ -912,7 +912,7 @@ final class SwitchTests: XCTestCase { } func testSwitch62() { - AssertParse( + assertParse( """ switch Whatever.Thing { case .Thing: @@ -927,7 +927,7 @@ final class SwitchTests: XCTestCase { } func testSwitch63() { - AssertParse( + assertParse( """ switch x { case 0: @@ -940,7 +940,7 @@ final class SwitchTests: XCTestCase { } func testSwitch64() { - AssertParse( + assertParse( """ switch x { case 0: @@ -956,7 +956,7 @@ final class SwitchTests: XCTestCase { } func testSwitch65() { - AssertParse( + assertParse( """ @unknown let _ = 1 """ @@ -964,7 +964,7 @@ final class SwitchTests: XCTestCase { } func testSwitch66() { - AssertParse( + assertParse( """ switch x { case _: @@ -975,7 +975,7 @@ final class SwitchTests: XCTestCase { } func testSwitch67() { - AssertParse( + assertParse( """ switch Whatever.Thing { case .Thing: @@ -1006,7 +1006,7 @@ final class SwitchTests: XCTestCase { } func testSwitch68() { - AssertParse( + assertParse( """ switch x { case 1: @@ -1019,7 +1019,7 @@ final class SwitchTests: XCTestCase { } func testSwitch69() { - AssertParse( + assertParse( """ switch x { @unknown case _: @@ -1030,7 +1030,7 @@ final class SwitchTests: XCTestCase { } func testSwitch70() { - AssertParse( + assertParse( """ switch x { @unknown default: @@ -1041,7 +1041,7 @@ final class SwitchTests: XCTestCase { } func testSwitch71() { - AssertParse( + assertParse( """ switch Whatever.Thing { case .Thing: @@ -1056,7 +1056,7 @@ final class SwitchTests: XCTestCase { } func testSwitch72() { - AssertParse( + assertParse( """ switch Whatever.Thing { case .Thing: @@ -1071,7 +1071,7 @@ final class SwitchTests: XCTestCase { } func testSwitch73() { - AssertParse( + assertParse( """ switch Whatever.Thing { case .Thing: @@ -1086,7 +1086,7 @@ final class SwitchTests: XCTestCase { } func testSwitch74() { - AssertParse( + assertParse( """ switch Whatever.Thing { @unknown case _: @@ -1099,7 +1099,7 @@ final class SwitchTests: XCTestCase { } func testSwitch75() { - AssertParse( + assertParse( """ switch Whatever.Thing { @unknown case _: @@ -1112,7 +1112,7 @@ final class SwitchTests: XCTestCase { } func testSwitch76() { - AssertParse( + assertParse( """ switch Whatever.Thing { @unknown default: @@ -1125,7 +1125,7 @@ final class SwitchTests: XCTestCase { } func testSwitch77() { - AssertParse( + assertParse( """ switch x { @unknown case _: @@ -1138,7 +1138,7 @@ final class SwitchTests: XCTestCase { } func testSwitch78() { - AssertParse( + assertParse( """ switch x { @unknown case _: @@ -1151,7 +1151,7 @@ final class SwitchTests: XCTestCase { } func testSwitch79() { - AssertParse( + assertParse( """ switch x { @unknown default: @@ -1164,7 +1164,7 @@ final class SwitchTests: XCTestCase { } func testSwitch80() { - AssertParse( + assertParse( """ func testReturnBeforeUnknownDefault() { switch x { @@ -1179,7 +1179,7 @@ final class SwitchTests: XCTestCase { } func testSwitch81() { - AssertParse( + assertParse( """ func testReturnBeforeIncompleteUnknownDefault() { switch x { @@ -1196,7 +1196,7 @@ final class SwitchTests: XCTestCase { } func testSwitch82() { - AssertParse( + assertParse( """ func testReturnBeforeIncompleteUnknownDefault2() { switch x { @@ -1213,7 +1213,7 @@ final class SwitchTests: XCTestCase { } func testSwitch83() { - AssertParse( + assertParse( """ func testIncompleteArrayLiteral() { switch x { diff --git a/Tests/SwiftParserTest/translated/ToplevelLibraryTests.swift b/Tests/SwiftParserTest/translated/ToplevelLibraryTests.swift index 670e7e4ed98..426f39fb098 100644 --- a/Tests/SwiftParserTest/translated/ToplevelLibraryTests.swift +++ b/Tests/SwiftParserTest/translated/ToplevelLibraryTests.swift @@ -16,7 +16,7 @@ import XCTest final class ToplevelLibraryTests: XCTestCase { func testToplevelLibrary1() { - AssertParse( + assertParse( """ // make sure trailing semicolons are valid syntax in toplevel library code. var x = 4; @@ -25,7 +25,7 @@ final class ToplevelLibraryTests: XCTestCase { } func testToplevelLibraryInvalid1() { - AssertParse( + assertParse( """ let x = 42 x + x; @@ -38,7 +38,7 @@ final class ToplevelLibraryTests: XCTestCase { } func testToplevelLibraryInvalid2() { - AssertParse( + assertParse( """ for i1️⃣ """, diff --git a/Tests/SwiftParserTest/translated/TrailingClosuresTests.swift b/Tests/SwiftParserTest/translated/TrailingClosuresTests.swift index 09fbff0a150..91b64277098 100644 --- a/Tests/SwiftParserTest/translated/TrailingClosuresTests.swift +++ b/Tests/SwiftParserTest/translated/TrailingClosuresTests.swift @@ -17,7 +17,7 @@ import XCTest final class TrailingClosuresTests: XCTestCase { func testTrailingClosures1() { - AssertParse( + assertParse( """ func foo(a: () -> T, b: () -> U) {} """ @@ -25,7 +25,7 @@ final class TrailingClosuresTests: XCTestCase { } func testTrailingClosures2() { - AssertParse( + assertParse( #""" foo { 42 } b: { "" } @@ -34,7 +34,7 @@ final class TrailingClosuresTests: XCTestCase { } func testTrailingClosures3() { - AssertParse( + assertParse( #""" foo { 42 } b: { "" } """# @@ -42,7 +42,7 @@ final class TrailingClosuresTests: XCTestCase { } func testTrailingClosures4() { - AssertParse( + assertParse( """ func when(_ condition: @autoclosure () -> Bool, `then` trueBranch: () -> T, @@ -54,7 +54,7 @@ final class TrailingClosuresTests: XCTestCase { } func testTrailingClosures5() { - AssertParse( + assertParse( """ let _ = when (2 < 3) { 3 } else: { 4 } """ @@ -62,7 +62,7 @@ final class TrailingClosuresTests: XCTestCase { } func testTrailingClosures6() { - AssertParse( + assertParse( """ struct S { static func foo(a: Int = 42, b: (inout Int) -> Void) -> S { @@ -89,7 +89,7 @@ final class TrailingClosuresTests: XCTestCase { } func testTrailingClosures7() { - AssertParse( + assertParse( """ let _: S = .foo { $0 = $0 + 1 @@ -99,7 +99,7 @@ final class TrailingClosuresTests: XCTestCase { } func testTrailingClosures8() { - AssertParse( + assertParse( """ let _: S = .foo {} b: { $0 = $0 + 1 } """ @@ -107,7 +107,7 @@ final class TrailingClosuresTests: XCTestCase { } func testTrailingClosures9() { - AssertParse( + assertParse( """ func bar(_ s: S) { _ = s[] { @@ -132,7 +132,7 @@ final class TrailingClosuresTests: XCTestCase { } func testTrailingClosures10() { - AssertParse( + assertParse( """ func multiple_trailing_with_defaults( duration: Int, @@ -143,7 +143,7 @@ final class TrailingClosuresTests: XCTestCase { } func testTrailingClosures11() { - AssertParse( + assertParse( """ multiple_trailing_with_defaults(duration: 42) {} """ @@ -151,7 +151,7 @@ final class TrailingClosuresTests: XCTestCase { } func testTrailingClosures12() { - AssertParse( + assertParse( """ multiple_trailing_with_defaults(duration: 42) {} completion: {} """ @@ -159,7 +159,7 @@ final class TrailingClosuresTests: XCTestCase { } func testTrailingClosures13a() { - AssertParse( + assertParse( """ fn {} g: {} fn {} _: {} @@ -174,7 +174,7 @@ final class TrailingClosuresTests: XCTestCase { } func testTrailingClosures13b() { - AssertParse( + assertParse( """ fn {} g: 1️⃣<#T##() -> Void#> """, @@ -201,7 +201,7 @@ final class TrailingClosuresTests: XCTestCase { func testTrailingClosures14() { // TODO: The diagnostics here are perhaps a little overboard. - AssertParse( + assertParse( """ func produce(fn: () -> Int?, default d: () -> Int) -> Int { return fn() ?? d() @@ -217,7 +217,7 @@ final class TrailingClosuresTests: XCTestCase { } func testTrailingClosures15() { - AssertParse( + assertParse( """ func f() -> Int { 42 } """ @@ -225,7 +225,7 @@ final class TrailingClosuresTests: XCTestCase { } func testTrailingClosures16() { - AssertParse( + assertParse( """ // This should be interpreted as a trailing closure, instead of being // interpreted as a computed property with undesired initial value. diff --git a/Tests/SwiftParserTest/translated/TrailingSemiTests.swift b/Tests/SwiftParserTest/translated/TrailingSemiTests.swift index 60d1b4d3160..1143cb45f69 100644 --- a/Tests/SwiftParserTest/translated/TrailingSemiTests.swift +++ b/Tests/SwiftParserTest/translated/TrailingSemiTests.swift @@ -16,7 +16,7 @@ import XCTest final class TrailingSemiTests: XCTestCase { func testTrailingSemi1() { - AssertParse( + assertParse( """ struct S { var a : Int ; @@ -28,7 +28,7 @@ final class TrailingSemiTests: XCTestCase { } func testTrailingSemi2() { - AssertParse( + assertParse( """ struct SpuriousSemi { 1️⃣; @@ -48,7 +48,7 @@ final class TrailingSemiTests: XCTestCase { } func testTrailingSemi3() { - AssertParse( + assertParse( """ class C { var a : Int = 101️⃣ func aa() {}; @@ -73,7 +73,7 @@ final class TrailingSemiTests: XCTestCase { } func testTrailingSemi4() { - AssertParse( + assertParse( """ extension S { //var a : Int ; @@ -89,7 +89,7 @@ final class TrailingSemiTests: XCTestCase { } func testTrailingSemi5() { - AssertParse( + assertParse( """ protocol P { var a : Int { get }; @@ -101,7 +101,7 @@ final class TrailingSemiTests: XCTestCase { } func testSingleTrailingSemiInStmt() { - AssertParse( + assertParse( """ let x = 5;1️⃣; """, @@ -113,7 +113,7 @@ final class TrailingSemiTests: XCTestCase { } func testDoubleTrailingSemiInStmt() { - AssertParse( + assertParse( """ let x = 5;1️⃣;; """, @@ -125,7 +125,7 @@ final class TrailingSemiTests: XCTestCase { } func testDoubleTrailingSemiInDecl() { - AssertParse( + assertParse( """ struct X { func foo() {};1️⃣;; @@ -143,7 +143,7 @@ final class TrailingSemiTests: XCTestCase { } func testMissingSemiInIfConfigOfDecls() { - AssertParse( + assertParse( """ struct X { #if FLAG1 @@ -165,7 +165,7 @@ final class TrailingSemiTests: XCTestCase { } func testMissingSemiInIfConfigOfStmts() { - AssertParse( + assertParse( """ func foo() { #if FLAG1 diff --git a/Tests/SwiftParserTest/translated/TryTests.swift b/Tests/SwiftParserTest/translated/TryTests.swift index 6b14cbd2a37..414df6fa7f9 100644 --- a/Tests/SwiftParserTest/translated/TryTests.swift +++ b/Tests/SwiftParserTest/translated/TryTests.swift @@ -16,7 +16,7 @@ import XCTest final class TryTests: XCTestCase { func testTry1() { - AssertParse( + assertParse( """ // Intentionally has lower precedence than assignments and ?: infix operator %%%% : LowPrecedence @@ -30,7 +30,7 @@ final class TryTests: XCTestCase { } func testTry2() { - AssertParse( + assertParse( """ // Intentionally has lower precedence between assignments and ?: infix operator %%% : MiddlingPrecedence @@ -45,7 +45,7 @@ final class TryTests: XCTestCase { } func testTry3() { - AssertParse( + assertParse( """ func foo() throws -> Int { return 0 } func bar() throws -> Int { return 0 } @@ -54,7 +54,7 @@ final class TryTests: XCTestCase { } func testTry4() { - AssertParse( + assertParse( """ var x = try foo() + bar() x = try foo() + bar() @@ -67,7 +67,7 @@ final class TryTests: XCTestCase { } func testTry5() { - AssertParse( + assertParse( """ var y = true ? try foo() : try bar() + 0 var z = true ? try foo() : try bar() %%% 0 @@ -76,7 +76,7 @@ final class TryTests: XCTestCase { } func testTry6() { - AssertParse( + assertParse( """ var a = try! foo() + bar() a = try! foo() + bar() @@ -89,7 +89,7 @@ final class TryTests: XCTestCase { } func testTry7() { - AssertParse( + assertParse( """ var b = true ? try! foo() : try! bar() + 0 var c = true ? try! foo() : try! bar() %%% 0 @@ -98,7 +98,7 @@ final class TryTests: XCTestCase { } func testTry8() { - AssertParse( + assertParse( """ infix operator ?+= : AssignmentPrecedence func ?+=(lhs: inout Int?, rhs: Int?) { @@ -109,7 +109,7 @@ final class TryTests: XCTestCase { } func testTry9() { - AssertParse( + assertParse( """ var i = try? foo() + bar() let _: Double = i @@ -126,7 +126,7 @@ final class TryTests: XCTestCase { } func testTry10() { - AssertParse( + assertParse( """ let j = true ? try? foo() : try? bar() + 0 let k = true ? try? foo() : try? bar() %%% 0 @@ -135,7 +135,7 @@ final class TryTests: XCTestCase { } func testTry11() { - AssertParse( + assertParse( """ 1️⃣try let singleLet = try foo() """, @@ -147,7 +147,7 @@ final class TryTests: XCTestCase { } func testTry11a() { - AssertParse( + assertParse( """ 1️⃣try let singleLet = foo() """, @@ -159,7 +159,7 @@ final class TryTests: XCTestCase { } func testTry11b() { - AssertParse( + assertParse( """ 1️⃣try var singleVar = foo() """, @@ -171,7 +171,7 @@ final class TryTests: XCTestCase { } func testTry11c() { - AssertParse( + assertParse( """ 1️⃣try let uninit: Int """, @@ -182,7 +182,7 @@ final class TryTests: XCTestCase { } func testTry11d() { - AssertParse( + assertParse( """ 1️⃣try let (destructure1, destructure2) = (foo(), bar()) """, @@ -194,7 +194,7 @@ final class TryTests: XCTestCase { } func testTry11e() { - AssertParse( + assertParse( """ 1️⃣try let multi1 = foo(), multi2 = bar() """, @@ -206,7 +206,7 @@ final class TryTests: XCTestCase { } func testTry11f() { - AssertParse( + assertParse( """ class TryDecl { 1️⃣try let singleLet = foo() @@ -224,7 +224,7 @@ final class TryTests: XCTestCase { } func testTry11g() { - AssertParse( + assertParse( """ class TryDecl { 1️⃣try var singleVar = foo() @@ -242,7 +242,7 @@ final class TryTests: XCTestCase { } func testTry11h() { - AssertParse( + assertParse( """ try1️⃣ func method() {} @@ -254,7 +254,7 @@ final class TryTests: XCTestCase { } func testTry11i() { - AssertParse( + assertParse( """ 1️⃣try func method() {} """, @@ -265,7 +265,7 @@ final class TryTests: XCTestCase { } func testTry12a() { - AssertParse( + assertParse( """ 1️⃣try while true { 2️⃣try break @@ -279,7 +279,7 @@ final class TryTests: XCTestCase { } func testTry12b() { - AssertParse( + assertParse( """ 1️⃣try throw 2️⃣ """, @@ -292,7 +292,7 @@ final class TryTests: XCTestCase { } func testTry12c() { - AssertParse( + assertParse( """ 1️⃣try return """, @@ -303,7 +303,7 @@ final class TryTests: XCTestCase { } func testTry12d() { - AssertParse( + assertParse( """ 1️⃣try throw foo() """, @@ -315,7 +315,7 @@ final class TryTests: XCTestCase { } func testTry12e() { - AssertParse( + assertParse( """ 1️⃣try return foo() """, @@ -327,7 +327,7 @@ final class TryTests: XCTestCase { } func testTry13() { - AssertParse( + assertParse( #""" // Test operators. func *(a : String, b : String) throws -> Int { return 42 } @@ -342,7 +342,7 @@ final class TryTests: XCTestCase { } func testTry14() { - AssertParse( + assertParse( """ // Assertion failure when compiling function that takes throwing functions and rethrows func rethrowsDispatchError(handleError: ((Error) throws -> ()), body: () throws -> ()) rethrows { @@ -356,7 +356,7 @@ final class TryTests: XCTestCase { } func testTry15() { - AssertParse( + assertParse( """ // Calling rethrows from rethrows crashes Swift compiler struct r21432429 { @@ -370,7 +370,7 @@ final class TryTests: XCTestCase { } func testTry16() { - AssertParse( + assertParse( """ // Swift 2: Omitting try from call to throwing closure in rethrowing function crashes compiler func callThrowingClosureWithoutTry(closure: (Int) throws -> Int) rethrows { @@ -381,7 +381,7 @@ final class TryTests: XCTestCase { } func testTry17() { - AssertParse( + assertParse( """ func producesOptional() throws -> Int? { return nil } let _: String = try? producesOptional() @@ -390,7 +390,7 @@ final class TryTests: XCTestCase { } func testTry18() { - AssertParse( + assertParse( """ let _ = (try? foo())!! """ @@ -398,7 +398,7 @@ final class TryTests: XCTestCase { } func testTry19() { - AssertParse( + assertParse( """ func producesDoubleOptional() throws -> Int?? { return 3 } let _: String = try? producesDoubleOptional() @@ -407,7 +407,7 @@ final class TryTests: XCTestCase { } func testTry20() { - AssertParse( + assertParse( """ func maybeThrow() throws {} try maybeThrow() // okay @@ -419,7 +419,7 @@ final class TryTests: XCTestCase { } func testTry21() { - AssertParse( + assertParse( """ let _: () -> Void = { try! maybeThrow() } // okay let _: () -> Void = { try? maybeThrow() } // okay since return type of maybeThrow is Void @@ -428,7 +428,7 @@ final class TryTests: XCTestCase { } func testTry22() { - AssertParse( + assertParse( """ if try? maybeThrow() { } @@ -438,7 +438,7 @@ final class TryTests: XCTestCase { } func testTry23() { - AssertParse( + assertParse( """ class X {} func test(_: X) {} @@ -449,7 +449,7 @@ final class TryTests: XCTestCase { } func testTry24() { - AssertParse( + assertParse( #""" _ = "a\(try maybeThrow())b" _ = try "a\(maybeThrow())b" @@ -459,7 +459,7 @@ final class TryTests: XCTestCase { } func testTry25() { - AssertParse( + assertParse( """ extension DefaultStringInterpolation { mutating func appendInterpolation() throws {} @@ -469,7 +469,7 @@ final class TryTests: XCTestCase { } func testTry26() { - AssertParse( + assertParse( #""" _ = try "a\()b" _ = "a\()b" @@ -479,7 +479,7 @@ final class TryTests: XCTestCase { } func testTry27() { - AssertParse( + assertParse( """ func testGenericOptionalTry(_ call: () throws -> T ) { let _: String = try? call() @@ -489,7 +489,7 @@ final class TryTests: XCTestCase { } func testTry28() { - AssertParse( + assertParse( """ func genericOptionalTry(_ call: () throws -> T ) -> T? { let x = try? call() // no error expected @@ -500,7 +500,7 @@ final class TryTests: XCTestCase { } func testTry29() { - AssertParse( + assertParse( """ // Test with a non-optional type let _: String = genericOptionalTry({ () throws -> Int in return 3 }) @@ -509,7 +509,7 @@ final class TryTests: XCTestCase { } func testTry30() { - AssertParse( + assertParse( """ // Test with an optional type let _: String = genericOptionalTry({ () throws -> Int? in return nil }) @@ -518,7 +518,7 @@ final class TryTests: XCTestCase { } func testTry31() { - AssertParse( + assertParse( """ func produceAny() throws -> Any { return 3 @@ -528,7 +528,7 @@ final class TryTests: XCTestCase { } func testTry32() { - AssertParse( + assertParse( """ let _: Int? = try? produceAny() as? Int let _: Int?? = (try? produceAny()) as? Int // good @@ -539,7 +539,7 @@ final class TryTests: XCTestCase { } func testTry33() { - AssertParse( + assertParse( """ struct ThingProducer { func produceInt() throws -> Int { return 3 } @@ -553,7 +553,7 @@ final class TryTests: XCTestCase { } func testTry34() { - AssertParse( + assertParse( """ let optProducer: ThingProducer? = ThingProducer() let _: Int? = try? optProducer?.produceInt() @@ -565,7 +565,7 @@ final class TryTests: XCTestCase { } func testTry35() { - AssertParse( + assertParse( """ let _: Int? = try? optProducer?.produceIntNoThrowing() let _: Int?? = try? optProducer?.produceIntNoThrowing() @@ -574,7 +574,7 @@ final class TryTests: XCTestCase { } func testTry36() { - AssertParse( + assertParse( """ let _: Int? = (try? optProducer?.produceAny()) as? Int // good let _: Int? = try? optProducer?.produceAny() as? Int @@ -585,7 +585,7 @@ final class TryTests: XCTestCase { } func testTry37() { - AssertParse( + assertParse( """ let _: String = try? optProducer?.produceDoubleOptionalInt() """ @@ -593,7 +593,7 @@ final class TryTests: XCTestCase { } func testTry38() { - AssertParse( + assertParse( """ let producer = ThingProducer() """ @@ -601,7 +601,7 @@ final class TryTests: XCTestCase { } func testTry39() { - AssertParse( + assertParse( """ let _: Int = try? producer.produceDoubleOptionalInt() let _: Int? = try? producer.produceDoubleOptionalInt() @@ -613,7 +613,7 @@ final class TryTests: XCTestCase { } func testTry40() { - AssertParse( + assertParse( """ // rdar://problem/46742002 protocol Dummy : class {} @@ -622,7 +622,7 @@ final class TryTests: XCTestCase { } func testTry41() { - AssertParse( + assertParse( """ class F { func wait() throws -> T { fatalError() } @@ -632,7 +632,7 @@ final class TryTests: XCTestCase { } func testTry42() { - AssertParse( + assertParse( """ func bar(_ a: F, _ b: F) { _ = (try? a.wait()) === (try? b.wait()) diff --git a/Tests/SwiftParserTest/translated/TypeExprTests.swift b/Tests/SwiftParserTest/translated/TypeExprTests.swift index a240ed35b5f..51a210f4fa2 100644 --- a/Tests/SwiftParserTest/translated/TypeExprTests.swift +++ b/Tests/SwiftParserTest/translated/TypeExprTests.swift @@ -19,7 +19,7 @@ import SwiftSyntax // constructor call. final class TypeExprTests: XCTestCase { func testTypeExpr3() { - AssertParse( + assertParse( """ struct Foo { struct Bar { @@ -38,7 +38,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr4() { - AssertParse( + assertParse( """ protocol Zim { associatedtype Zang @@ -52,7 +52,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr5() { - AssertParse( + assertParse( """ protocol Bad { init() {} @@ -62,7 +62,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr6() { - AssertParse( + assertParse( """ struct Gen { struct Bar { @@ -81,7 +81,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr7() { - AssertParse( + assertParse( """ func unqualifiedType() { _ = Foo.self @@ -100,7 +100,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr8() { - AssertParse( + assertParse( """ func qualifiedType() { _ = Foo.Bar.self @@ -117,13 +117,13 @@ final class TypeExprTests: XCTestCase { """ ) - AssertParse("(X).Y.self", ExprSyntax.parse) - AssertParse("(X.Y).Z.self", ExprSyntax.parse) - AssertParse("((X).Y).Z.self", ExprSyntax.parse) + assertParse("(X).Y.self", ExprSyntax.parse) + assertParse("(X.Y).Z.self", ExprSyntax.parse) + assertParse("((X).Y).Z.self", ExprSyntax.parse) } func testTypeExpr9() { - AssertParse( + assertParse( """ // We allow '.Type' in expr context func metaType() { @@ -137,7 +137,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr10() { - AssertParse( + assertParse( """ func genType() { _ = Gen.self @@ -155,13 +155,13 @@ final class TypeExprTests: XCTestCase { """ ) - AssertParse("X?.self", ExprSyntax.parse) - AssertParse("[X].self", ExprSyntax.parse) - AssertParse("[X : Y].self", ExprSyntax.parse) + assertParse("X?.self", ExprSyntax.parse) + assertParse("[X].self", ExprSyntax.parse) + assertParse("[X : Y].self", ExprSyntax.parse) } func testTypeExpr11() { - AssertParse( + assertParse( """ func genQualifiedType() { _ = Gen.Bar.self @@ -183,16 +183,16 @@ final class TypeExprTests: XCTestCase { """ ) - AssertParse("(G).Y.self", ExprSyntax.parse) - AssertParse("X?.Y.self", ExprSyntax.parse) - AssertParse("(X)?.Y.self", ExprSyntax.parse) - AssertParse("(X?).Y.self", ExprSyntax.parse) - AssertParse("[X].Y.self", ExprSyntax.parse) - AssertParse("[X : Y].Z.self", ExprSyntax.parse) + assertParse("(G).Y.self", ExprSyntax.parse) + assertParse("X?.Y.self", ExprSyntax.parse) + assertParse("(X)?.Y.self", ExprSyntax.parse) + assertParse("(X?).Y.self", ExprSyntax.parse) + assertParse("[X].Y.self", ExprSyntax.parse) + assertParse("[X : Y].Z.self", ExprSyntax.parse) } func testTypeExpr12() { - AssertParse( + assertParse( """ func typeOfShadowing() { // Try to shadow type(of:) @@ -219,7 +219,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr13() { - AssertParse( + assertParse( """ func archetype(_: T) { _ = T.self @@ -234,7 +234,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr14() { - AssertParse( + assertParse( """ func assocType(_: T) where T.Zang: Zim { _ = T.Zang.self @@ -249,7 +249,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr15() { - AssertParse( + assertParse( """ class B { class func baseMethod() {} @@ -262,7 +262,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr16() { - AssertParse( + assertParse( """ func derivedType() { let _: B.Type = D.self @@ -279,7 +279,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr17() { - AssertParse( + assertParse( #""" // Referencing a nonexistent member or constructor should not trigger errors // about the type expression. @@ -293,7 +293,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr18() { - AssertParse( + assertParse( """ protocol P {} """ @@ -301,7 +301,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr19() { - AssertParse( + assertParse( """ func meta_metatypes() { let _: P.Protocol = P.self @@ -316,7 +316,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr20() { - AssertParse( + assertParse( """ class E { private init() {} @@ -326,7 +326,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr21() { - AssertParse( + assertParse( """ func inAccessibleInit() { _ = E @@ -336,7 +336,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr22() { - AssertParse( + assertParse( """ enum F: Int { case A, B @@ -346,7 +346,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr23() { - AssertParse( + assertParse( """ struct G { var x: Int @@ -356,7 +356,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr24() { - AssertParse( + assertParse( """ func implicitInit() { _ = F @@ -367,7 +367,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr25a() { - AssertParse( + assertParse( """ _ = [(Int) -> Int]() """ @@ -375,7 +375,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr25b() { - AssertParse( + assertParse( """ _ = [(Int, Int) -> Int]() """ @@ -383,7 +383,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr25c() { - AssertParse( + assertParse( """ _ = [(x: Int, y: Int) -> Int]() """ @@ -391,7 +391,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr25d() { - AssertParse( + assertParse( """ // Make sure associativity is correct let a = [(Int) -> (Int) -> Int]() @@ -400,7 +400,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr25e() { - AssertParse( + assertParse( """ let b: Int = a[0](5)(4) """ @@ -408,7 +408,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr25f() { - AssertParse( + assertParse( """ _ = [String: (Int) -> Int]() """ @@ -416,7 +416,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr25g() { - AssertParse( + assertParse( """ _ = [String: (Int, Int) -> Int]() """ @@ -424,7 +424,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr25h() { - AssertParse( + assertParse( """ _ = [1 -> Int]() """ @@ -432,7 +432,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr25i() { - AssertParse( + assertParse( """ _ = [Int -> 1]() """ @@ -440,7 +440,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr25j() { - AssertParse( + assertParse( """ // Should parse () as void type when before or after arrow _ = [() -> Int]() @@ -449,7 +449,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr25k() { - AssertParse( + assertParse( """ _ = [(Int) -> ()]() """ @@ -457,7 +457,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr25l() { - AssertParse( + assertParse( """ _ = 2 + () -> Int """ @@ -465,7 +465,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr25m() { - AssertParse( + assertParse( """ _ = () -> (Int, Int).2 """ @@ -473,7 +473,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr25n() { - AssertParse( + assertParse( """ _ = (Int) -> Int """ @@ -481,7 +481,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr25o() { - AssertParse( + assertParse( """ _ = @convention(c) () -> Int """ @@ -489,7 +489,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr25p() { - AssertParse( + assertParse( """ _ = 1 + (@convention(c) () -> Int).self """ @@ -497,7 +497,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr25q() { - AssertParse( + assertParse( """ _ = (@autoclosure () -> Int) -> (Int, Int).2 """ @@ -505,7 +505,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr25r() { - AssertParse( + assertParse( """ _ = ((@autoclosure () -> Int) -> (Int, Int)).1 """ @@ -513,7 +513,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr25s() { - AssertParse( + assertParse( """ _ = ((inout Int) -> Void).self """ @@ -521,7 +521,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr25t() { - AssertParse( + assertParse( """ _ = [(Int) throws -> Int]() """ @@ -529,7 +529,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr25u() { - AssertParse( + assertParse( """ _ = [@convention(swift) (Int) throws -> Int]().count """ @@ -537,7 +537,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr25v() { - AssertParse( + assertParse( """ _ = [(inout Int) throws -> (inout () -> Void) -> Void]().count """ @@ -545,7 +545,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr25w() { - AssertParse( + assertParse( """ _ = [String: (@autoclosure (Int) -> Int32) -> Void]().keys """ @@ -553,7 +553,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr25x() { - AssertParse( + assertParse( """ let _ = [(Int) -> 1️⃣throws Int]() """, @@ -567,7 +567,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr25y() { - AssertParse( + assertParse( """ let _ = [Int throws 1️⃣Int](); """, @@ -578,59 +578,59 @@ final class TypeExprTests: XCTestCase { } func testCompositionTypeExpr() { - AssertParse("P & Q", ExprSyntax.parse) - AssertParse("P & Q.self", ExprSyntax.parse) - AssertParse("any P & Q", ExprSyntax.parse) + assertParse("P & Q", ExprSyntax.parse) + assertParse("P & Q.self", ExprSyntax.parse) + assertParse("any P & Q", ExprSyntax.parse) - AssertParse("(P & Q).self", ExprSyntax.parse) - AssertParse("((P) & (Q)).self", ExprSyntax.parse) + assertParse("(P & Q).self", ExprSyntax.parse) + assertParse("((P) & (Q)).self", ExprSyntax.parse) - AssertParse("(A.B & C.D).self", ExprSyntax.parse) - AssertParse("((A).B & (C).D).self", ExprSyntax.parse) + assertParse("(A.B & C.D).self", ExprSyntax.parse) + assertParse("((A).B & (C).D).self", ExprSyntax.parse) - AssertParse("(G & G).self", ExprSyntax.parse) - AssertParse("(X? & Y?).self", ExprSyntax.parse) - AssertParse("([X] & [Y]).self", ExprSyntax.parse) - AssertParse("([A : B] & [C : D]).self", ExprSyntax.parse) + assertParse("(G & G).self", ExprSyntax.parse) + assertParse("(X? & Y?).self", ExprSyntax.parse) + assertParse("([X] & [Y]).self", ExprSyntax.parse) + assertParse("([A : B] & [C : D]).self", ExprSyntax.parse) - AssertParse("(G.B & G.D).self", ExprSyntax.parse) - AssertParse("(A?.B & C?.D).self", ExprSyntax.parse) - AssertParse("([A].B & [A].B).self", ExprSyntax.parse) - AssertParse("([A : B].C & [D : E].F).self", ExprSyntax.parse) + assertParse("(G.B & G.D).self", ExprSyntax.parse) + assertParse("(A?.B & C?.D).self", ExprSyntax.parse) + assertParse("([A].B & [A].B).self", ExprSyntax.parse) + assertParse("([A : B].C & [D : E].F).self", ExprSyntax.parse) - AssertParse("(X.Type & Y.Type).self", ExprSyntax.parse) - AssertParse("(X.Protocol & Y.Protocol).self", ExprSyntax.parse) + assertParse("(X.Type & Y.Type).self", ExprSyntax.parse) + assertParse("(X.Protocol & Y.Protocol).self", ExprSyntax.parse) - AssertParse("((A, B) & (C, D)).self", ExprSyntax.parse) + assertParse("((A, B) & (C, D)).self", ExprSyntax.parse) } func testTupleTypeExpr() { - AssertParse("(X).self", ExprSyntax.parse) + assertParse("(X).self", ExprSyntax.parse) - AssertParse("(X, Y)", ExprSyntax.parse) + assertParse("(X, Y)", ExprSyntax.parse) - AssertParse("(X, Y).self", ExprSyntax.parse) - AssertParse("((X), (Y)).self", ExprSyntax.parse) + assertParse("(X, Y).self", ExprSyntax.parse) + assertParse("((X), (Y)).self", ExprSyntax.parse) - AssertParse("(A.B, C.D).self", ExprSyntax.parse) - AssertParse("((A).B, (C).D).self", ExprSyntax.parse) + assertParse("(A.B, C.D).self", ExprSyntax.parse) + assertParse("((A).B, (C).D).self", ExprSyntax.parse) - AssertParse("(G, G).self", ExprSyntax.parse) - AssertParse("(X?, Y?).self", ExprSyntax.parse) - AssertParse("([X], [Y]).self", ExprSyntax.parse) - AssertParse("([A : B], [C : D]).self", ExprSyntax.parse) + assertParse("(G, G).self", ExprSyntax.parse) + assertParse("(X?, Y?).self", ExprSyntax.parse) + assertParse("([X], [Y]).self", ExprSyntax.parse) + assertParse("([A : B], [C : D]).self", ExprSyntax.parse) - AssertParse("(G.B, G.D).self", ExprSyntax.parse) - AssertParse("(A?.B, C?.D).self", ExprSyntax.parse) - AssertParse("([A].B, [C].D).self", ExprSyntax.parse) - AssertParse("([A : B].C, [D : E].F).self", ExprSyntax.parse) + assertParse("(G.B, G.D).self", ExprSyntax.parse) + assertParse("(A?.B, C?.D).self", ExprSyntax.parse) + assertParse("([A].B, [C].D).self", ExprSyntax.parse) + assertParse("([A : B].C, [D : E].F).self", ExprSyntax.parse) - AssertParse("(X.Type, Y.Type).self", ExprSyntax.parse) - AssertParse("(X.Protocol, Y.Protocol).self", ExprSyntax.parse) + assertParse("(X.Type, Y.Type).self", ExprSyntax.parse) + assertParse("(X.Protocol, Y.Protocol).self", ExprSyntax.parse) - AssertParse("(P & Q, P & Q).self", ExprSyntax.parse) + assertParse("(P & Q, P & Q).self", ExprSyntax.parse) - AssertParse( + assertParse( """ ( (G.Y) -> (P) & X?.Y, (X.Y, [X : Y?].Type), [(G).Y], [A.B.C].D @@ -641,38 +641,38 @@ final class TypeExprTests: XCTestCase { } func testFunctionTypeExpr() { - AssertParse("X -> Y", ExprSyntax.parse) - AssertParse("(X) -> Y", ExprSyntax.parse) - AssertParse("(X) -> Y -> Z", ExprSyntax.parse) - AssertParse("P & Q -> X", ExprSyntax.parse) - AssertParse("A & B -> C & D -> X", ExprSyntax.parse) - AssertParse("(X -> Y).self", ExprSyntax.parse) - AssertParse("(A & B -> C & D).self", ExprSyntax.parse) + assertParse("X -> Y", ExprSyntax.parse) + assertParse("(X) -> Y", ExprSyntax.parse) + assertParse("(X) -> Y -> Z", ExprSyntax.parse) + assertParse("P & Q -> X", ExprSyntax.parse) + assertParse("A & B -> C & D -> X", ExprSyntax.parse) + assertParse("(X -> Y).self", ExprSyntax.parse) + assertParse("(A & B -> C & D).self", ExprSyntax.parse) - AssertParse("((X) -> Y).self", ExprSyntax.parse) - AssertParse("(((X)) -> (Y)).self", ExprSyntax.parse) + assertParse("((X) -> Y).self", ExprSyntax.parse) + assertParse("(((X)) -> (Y)).self", ExprSyntax.parse) - AssertParse("((A.B) -> C.D).self", ExprSyntax.parse) - AssertParse("(((A).B) -> (C).D).self", ExprSyntax.parse) + assertParse("((A.B) -> C.D).self", ExprSyntax.parse) + assertParse("(((A).B) -> (C).D).self", ExprSyntax.parse) - AssertParse("((G) -> G).self", ExprSyntax.parse) - AssertParse("((X?) -> Y?).self", ExprSyntax.parse) - AssertParse("(([X]) -> [Y]).self", ExprSyntax.parse) - AssertParse("(([A : B]) -> [C : D]).self", ExprSyntax.parse) + assertParse("((G) -> G).self", ExprSyntax.parse) + assertParse("((X?) -> Y?).self", ExprSyntax.parse) + assertParse("(([X]) -> [Y]).self", ExprSyntax.parse) + assertParse("(([A : B]) -> [C : D]).self", ExprSyntax.parse) - AssertParse("((Gen.Bar) -> Gen.Bar).self", ExprSyntax.parse) - AssertParse("((Foo?.Bar) -> Foo?.Bar).self", ExprSyntax.parse) - AssertParse("(([Foo].Element) -> [Foo].Element).self", ExprSyntax.parse) - AssertParse("(([Int : Foo].Element) -> [Int : Foo].Element).self", ExprSyntax.parse) + assertParse("((Gen.Bar) -> Gen.Bar).self", ExprSyntax.parse) + assertParse("((Foo?.Bar) -> Foo?.Bar).self", ExprSyntax.parse) + assertParse("(([Foo].Element) -> [Foo].Element).self", ExprSyntax.parse) + assertParse("(([Int : Foo].Element) -> [Int : Foo].Element).self", ExprSyntax.parse) - AssertParse("((X.Type) -> Y.Type).self", ExprSyntax.parse) - AssertParse("((X.Protocol) -> Y.Protocol).self", ExprSyntax.parse) + assertParse("((X.Type) -> Y.Type).self", ExprSyntax.parse) + assertParse("((X.Protocol) -> Y.Protocol).self", ExprSyntax.parse) - AssertParse("(() -> X & Y).self", ExprSyntax.parse) - AssertParse("((A & B) -> C & D).self", ExprSyntax.parse) - AssertParse("((A & B) -> (C & D) -> E & Any).self", ExprSyntax.parse) + assertParse("(() -> X & Y).self", ExprSyntax.parse) + assertParse("((A & B) -> C & D).self", ExprSyntax.parse) + assertParse("((A & B) -> (C & D) -> E & Any).self", ExprSyntax.parse) - AssertParse( + assertParse( """ ( ((P) & X?.Y, G.Y, (X, [A : B?].Type)) -> ([(X).Y]) -> [X].Y @@ -683,7 +683,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr27() { - AssertParse( + assertParse( """ func complexSequence() { // (assign_expr @@ -697,7 +697,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr28() { - AssertParse( + assertParse( """ func takesVoid(f: 1️⃣Void 2️⃣-> ()) {} """, @@ -709,7 +709,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr29() { - AssertParse( + assertParse( """ func takesOneArg(_: T.Type) {} func takesTwoArgs(_: T.Type, _: Int) {} @@ -718,7 +718,7 @@ final class TypeExprTests: XCTestCase { } func testTypeExpr30() { - AssertParse( + assertParse( """ func testMissingSelf() { // None of these were not caught in Swift 3. diff --git a/Tests/SwiftParserTest/translated/TypealiasTests.swift b/Tests/SwiftParserTest/translated/TypealiasTests.swift index 3c775b48d07..12fd7af8408 100644 --- a/Tests/SwiftParserTest/translated/TypealiasTests.swift +++ b/Tests/SwiftParserTest/translated/TypealiasTests.swift @@ -16,7 +16,7 @@ import XCTest final class TypealiasTests: XCTestCase { func testTypealias2a() { - AssertParse( + assertParse( """ typealias IntPair = (Int, Int) """ @@ -24,7 +24,7 @@ final class TypealiasTests: XCTestCase { } func testTypealias2b() { - AssertParse( + assertParse( """ typealias IntTriple = (Int, Int, Int) """ @@ -32,7 +32,7 @@ final class TypealiasTests: XCTestCase { } func testTypealias2c() { - AssertParse( + assertParse( """ typealias FiveInts = (IntPair, IntTriple) """ @@ -40,7 +40,7 @@ final class TypealiasTests: XCTestCase { } func testTypealias2d() { - AssertParse( + assertParse( """ var fiveInts : FiveInts = ((4,2), (1,2,3)) """ @@ -49,7 +49,7 @@ final class TypealiasTests: XCTestCase { // QoI: poor diagnostic in malformed typealias func testTypealias3a() { - AssertParse( + assertParse( """ typealias Foo1 1️⃣: Int """, @@ -61,7 +61,7 @@ final class TypealiasTests: XCTestCase { } func testTypealias3b() { - AssertParse( + assertParse( """ typealias Foo21️⃣: Int """, @@ -73,7 +73,7 @@ final class TypealiasTests: XCTestCase { } func testTypealias3c() { - AssertParse( + assertParse( """ typealias Foo3 1️⃣:Int """, @@ -85,7 +85,7 @@ final class TypealiasTests: XCTestCase { } func testTypealias3d() { - AssertParse( + assertParse( """ typealias Foo41️⃣:/*comment*/Int """, @@ -97,7 +97,7 @@ final class TypealiasTests: XCTestCase { } func testTypealias5() { - AssertParse( + assertParse( """ typealias Recovery11️⃣ """, @@ -108,7 +108,7 @@ final class TypealiasTests: XCTestCase { } func testTypealias6() { - AssertParse( + assertParse( """ typealias Recovery2 1️⃣:2️⃣ """, @@ -120,7 +120,7 @@ final class TypealiasTests: XCTestCase { } func testTypealias7() { - AssertParse( + assertParse( """ typealias Recovery3 =1️⃣ """, @@ -131,7 +131,7 @@ final class TypealiasTests: XCTestCase { } func testTypealias8() { - AssertParse( + assertParse( """ typealias Recovery4 1️⃣: Int """, @@ -142,7 +142,7 @@ final class TypealiasTests: XCTestCase { } func testTypealias9() { - AssertParse( + assertParse( """ typealias Recovery5 1️⃣: Int2️⃣, Float """, @@ -154,7 +154,7 @@ final class TypealiasTests: XCTestCase { } func testTypealias10() { - AssertParse( + assertParse( """ typealias Recovery6 = 1️⃣= """, @@ -166,7 +166,7 @@ final class TypealiasTests: XCTestCase { } func testTypealias11() { - AssertParse( + assertParse( """ typealias 1️⃣switch = Int """, diff --git a/Tests/SwiftParserTest/translated/UnclosedStringInterpolationTests.swift b/Tests/SwiftParserTest/translated/UnclosedStringInterpolationTests.swift index 4eca63fd6a3..6defd396454 100644 --- a/Tests/SwiftParserTest/translated/UnclosedStringInterpolationTests.swift +++ b/Tests/SwiftParserTest/translated/UnclosedStringInterpolationTests.swift @@ -16,7 +16,7 @@ import XCTest final class UnclosedStringInterpolationTests: XCTestCase { func testUnclosedStringInterpolation1() { - AssertParse( + assertParse( #""" let mid = "pete" """# @@ -24,7 +24,7 @@ final class UnclosedStringInterpolationTests: XCTestCase { } func testUnclosedStringInterpolation2() { - AssertParse( + assertParse( ##""" _ = "mid == \(pete1️⃣" """##, @@ -35,7 +35,7 @@ final class UnclosedStringInterpolationTests: XCTestCase { } func testUnclosedStringInterpolation3() { - AssertParse( + assertParse( ##""" let theGoat = "kanye \("1️⃣ """##, @@ -48,7 +48,7 @@ final class UnclosedStringInterpolationTests: XCTestCase { } func testUnclosedStringInterpolation4() { - AssertParse( + assertParse( ##""" let equation1 = "2 + 2 = \(2 + 21️⃣" """##, @@ -59,7 +59,7 @@ final class UnclosedStringInterpolationTests: XCTestCase { } func testUnclosedStringInterpolation5() { - AssertParse( + assertParse( ##""" let s = "\(x1️⃣"; print(x) """##, @@ -70,7 +70,7 @@ final class UnclosedStringInterpolationTests: XCTestCase { } func testUnclosedStringInterpolation6() { - AssertParse( + assertParse( ##""" let zzz = "\(x1️⃣; print(x)2️⃣ """##, @@ -82,7 +82,7 @@ final class UnclosedStringInterpolationTests: XCTestCase { } func testUnclosedStringInterpolation7() { - AssertParse( + assertParse( ##""" let goatedAlbum = "The Life Of \("Pablo"1️⃣ """##, @@ -94,7 +94,7 @@ final class UnclosedStringInterpolationTests: XCTestCase { } func testUnclosedStringInterpolation8() { - AssertParse( + assertParse( ##""" _ = """ \( @@ -109,7 +109,7 @@ final class UnclosedStringInterpolationTests: XCTestCase { } func testSkipUnexpectedOpeningParensInStringLiteral() { - AssertParse( + assertParse( #""" "\(e 1️⃣H()r2️⃣ """#, @@ -121,7 +121,7 @@ final class UnclosedStringInterpolationTests: XCTestCase { } func testUnterminatedStringLiteralInInterpolation() { - AssertParse( + assertParse( #""" "\("1️⃣ """#, diff --git a/Tests/SwiftRefactorTest/FormatRawStringLiteral.swift b/Tests/SwiftRefactorTest/FormatRawStringLiteral.swift index ea8a94fbba0..ba1354ae925 100644 --- a/Tests/SwiftRefactorTest/FormatRawStringLiteral.swift +++ b/Tests/SwiftRefactorTest/FormatRawStringLiteral.swift @@ -35,7 +35,7 @@ final class FormatRawStringLiteralTest: XCTestCase { let literal = try XCTUnwrap(StringLiteralExprSyntax.parseWithoutDiagnostics(from: literal)) let expectation = try XCTUnwrap(StringLiteralExprSyntax.parseWithoutDiagnostics(from: expectation)) let refactored = try XCTUnwrap(FormatRawStringLiteral.refactor(syntax: literal)) - AssertStringsEqualWithDiff(refactored.description, expectation.description, line: UInt(line)) + assertStringsEqualWithDiff(refactored.description, expectation.description, line: UInt(line)) } } } diff --git a/Tests/SwiftRefactorTest/MigrateToNewIfLetSyntax.swift b/Tests/SwiftRefactorTest/MigrateToNewIfLetSyntax.swift index c76aae41f4c..14b1de3f80e 100644 --- a/Tests/SwiftRefactorTest/MigrateToNewIfLetSyntax.swift +++ b/Tests/SwiftRefactorTest/MigrateToNewIfLetSyntax.swift @@ -17,7 +17,7 @@ import SwiftSyntaxBuilder import XCTest import _SwiftSyntaxTestSupport -func AssertRefactorIfLet( +func assertRefactorIfLet( _ syntax: ExprSyntax, expected: ExprSyntax, file: StaticString = #file, @@ -35,7 +35,7 @@ func AssertRefactorIfLet( line: line ) - AssertStringsEqualWithDiff( + assertStringsEqualWithDiff( expected.description, refactored.description, file: file, @@ -53,7 +53,7 @@ final class MigrateToNewIfLetSyntaxTest: XCTestCase { if let x {} """ - try AssertRefactorIfLet(baselineSyntax, expected: expectedSyntax) + try assertRefactorIfLet(baselineSyntax, expected: expectedSyntax) } func testIdempotence() throws { @@ -65,8 +65,8 @@ final class MigrateToNewIfLetSyntaxTest: XCTestCase { if let x {} """ - try AssertRefactorIfLet(baselineSyntax, expected: expectedSyntax) - try AssertRefactorIfLet(expectedSyntax, expected: expectedSyntax) + try assertRefactorIfLet(baselineSyntax, expected: expectedSyntax) + try assertRefactorIfLet(expectedSyntax, expected: expectedSyntax) } func testMultiBinding() throws { @@ -78,7 +78,7 @@ final class MigrateToNewIfLetSyntaxTest: XCTestCase { if let x, var y, let z {} """ - try AssertRefactorIfLet(baselineSyntax, expected: expectedSyntax) + try assertRefactorIfLet(baselineSyntax, expected: expectedSyntax) } func testMixedBinding() throws { @@ -90,7 +90,7 @@ final class MigrateToNewIfLetSyntaxTest: XCTestCase { if let x, var y = x, let z = y.w {} """ - try AssertRefactorIfLet(baselineSyntax, expected: expectedSyntax) + try assertRefactorIfLet(baselineSyntax, expected: expectedSyntax) } func testConditions() throws { @@ -102,7 +102,7 @@ final class MigrateToNewIfLetSyntaxTest: XCTestCase { if let x = x + 1, x == x, !x {} """ - try AssertRefactorIfLet(baselineSyntax, expected: expectedSyntax) + try assertRefactorIfLet(baselineSyntax, expected: expectedSyntax) } func testWhitespaceNormalization() throws { @@ -114,7 +114,7 @@ final class MigrateToNewIfLetSyntaxTest: XCTestCase { if let x, let y {} """ - try AssertRefactorIfLet(baselineSyntax, expected: expectedSyntax) + try assertRefactorIfLet(baselineSyntax, expected: expectedSyntax) } func testIfStmt() throws { @@ -127,6 +127,6 @@ final class MigrateToNewIfLetSyntaxTest: XCTestCase { """ let exprStmt = try XCTUnwrap(baselineSyntax.as(ExpressionStmtSyntax.self)) - try AssertRefactorIfLet(exprStmt.expression, expected: expectedSyntax) + try assertRefactorIfLet(exprStmt.expression, expected: expectedSyntax) } } diff --git a/Tests/SwiftRefactorTest/OpaqueParameterToGeneric.swift b/Tests/SwiftRefactorTest/OpaqueParameterToGeneric.swift index 3fab8c75a54..5c5f9ae41db 100644 --- a/Tests/SwiftRefactorTest/OpaqueParameterToGeneric.swift +++ b/Tests/SwiftRefactorTest/OpaqueParameterToGeneric.swift @@ -35,7 +35,7 @@ final class OpaqueParameterToGenericTest: XCTestCase { let refactored = try XCTUnwrap(OpaqueParameterToGeneric.refactor(syntax: baseline)) - AssertStringsEqualWithDiff(expected.description, refactored.description) + assertStringsEqualWithDiff(expected.description, refactored.description) } func testRefactoringInit() throws { @@ -55,7 +55,7 @@ final class OpaqueParameterToGenericTest: XCTestCase { let refactored = try XCTUnwrap(OpaqueParameterToGeneric.refactor(syntax: baseline)) - AssertStringsEqualWithDiff(expected.description, refactored.description) + assertStringsEqualWithDiff(expected.description, refactored.description) } func testRefactoringSubscript() throws { @@ -69,6 +69,6 @@ final class OpaqueParameterToGenericTest: XCTestCase { let refactored = try XCTUnwrap(OpaqueParameterToGeneric.refactor(syntax: baseline)) - AssertStringsEqualWithDiff(expected.description, refactored.description) + assertStringsEqualWithDiff(expected.description, refactored.description) } } diff --git a/Tests/SwiftRefactorTest/ReformatIntegerLiteral.swift b/Tests/SwiftRefactorTest/ReformatIntegerLiteral.swift index f66c14d3922..ccc7cdf555f 100644 --- a/Tests/SwiftRefactorTest/ReformatIntegerLiteral.swift +++ b/Tests/SwiftRefactorTest/ReformatIntegerLiteral.swift @@ -34,7 +34,7 @@ final class ReformatIntegerLiteralTest: XCTestCase { for (line, literal, expectation) in tests { let refactored = try XCTUnwrap(AddSeparatorsToIntegerLiteral.refactor(syntax: literal)) - AssertStringsEqualWithDiff(refactored.description, expectation.description, line: UInt(line)) + assertStringsEqualWithDiff(refactored.description, expectation.description, line: UInt(line)) } } @@ -50,7 +50,7 @@ final class ReformatIntegerLiteralTest: XCTestCase { for (line, literal, expectation) in tests { let refactored = try XCTUnwrap(RemoveSeparatorsFromIntegerLiteral.refactor(syntax: literal)) - AssertStringsEqualWithDiff(refactored.description, expectation.description, line: UInt(line)) + assertStringsEqualWithDiff(refactored.description, expectation.description, line: UInt(line)) } } } diff --git a/Tests/SwiftSyntaxBuilderTest/ArrayExprTests.swift b/Tests/SwiftSyntaxBuilderTest/ArrayExprTests.swift index 360fdea7cc3..6f3f383e841 100644 --- a/Tests/SwiftSyntaxBuilderTest/ArrayExprTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/ArrayExprTests.swift @@ -21,7 +21,7 @@ final class ArrayExprTests: XCTestCase { ArrayElementSyntax(expression: IntegerLiteralExprSyntax(i)) } } - AssertBuildResult(buildable, "[1, 2, 3, 4]") + assertBuildResult(buildable, "[1, 2, 3, 4]") } func testMultilineArrayLiteral() { @@ -35,7 +35,7 @@ final class ArrayExprTests: XCTestCase { ] """ ) - AssertBuildResult( + assertBuildResult( builder, """ [ diff --git a/Tests/SwiftSyntaxBuilderTest/Assertions.swift b/Tests/SwiftSyntaxBuilderTest/Assertions.swift index 4c0b1d7defc..d7fe0aee3b0 100644 --- a/Tests/SwiftSyntaxBuilderTest/Assertions.swift +++ b/Tests/SwiftSyntaxBuilderTest/Assertions.swift @@ -16,14 +16,14 @@ import _SwiftSyntaxTestSupport import XCTest -func AssertBuildResult(_ buildable: T, _ expectedResult: String, trimTrailingWhitespace: Bool = true, file: StaticString = #file, line: UInt = #line) { +func assertBuildResult(_ buildable: T, _ expectedResult: String, trimTrailingWhitespace: Bool = true, file: StaticString = #file, line: UInt = #line) { var buildableDescription = buildable.formatted().description var expectedResult = expectedResult if trimTrailingWhitespace { buildableDescription = buildableDescription.trimmingTrailingWhitespace() expectedResult = expectedResult.trimmingTrailingWhitespace() } - AssertStringsEqualWithDiff( + assertStringsEqualWithDiff( buildableDescription, expectedResult, file: file, diff --git a/Tests/SwiftSyntaxBuilderTest/BooleanLiteralTests.swift b/Tests/SwiftSyntaxBuilderTest/BooleanLiteralTests.swift index 92d92674ecf..c36c08fd699 100644 --- a/Tests/SwiftSyntaxBuilderTest/BooleanLiteralTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/BooleanLiteralTests.swift @@ -27,7 +27,7 @@ final class BooleanLiteralTests: XCTestCase { for (line, testCase) in testCases { let (builder, expected) = testCase - AssertBuildResult(builder, expected, line: line) + assertBuildResult(builder, expected, line: line) } } } diff --git a/Tests/SwiftSyntaxBuilderTest/BreakStmtSyntaxTests.swift b/Tests/SwiftSyntaxBuilderTest/BreakStmtSyntaxTests.swift index a2198263891..e378e3826c6 100644 --- a/Tests/SwiftSyntaxBuilderTest/BreakStmtSyntaxTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/BreakStmtSyntaxTests.swift @@ -23,7 +23,7 @@ final class BreakStmtSyntaxTests: XCTestCase { for (line, testCase) in testCases { let (builder, expected) = testCase - AssertBuildResult(builder, expected, trimTrailingWhitespace: false, line: line) + assertBuildResult(builder, expected, trimTrailingWhitespace: false, line: line) } } } diff --git a/Tests/SwiftSyntaxBuilderTest/ClassDeclSyntaxTests.swift b/Tests/SwiftSyntaxBuilderTest/ClassDeclSyntaxTests.swift index 844016d0505..d1b45b91bc7 100644 --- a/Tests/SwiftSyntaxBuilderTest/ClassDeclSyntaxTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/ClassDeclSyntaxTests.swift @@ -22,7 +22,7 @@ final class ClassDeclSyntaxTests: XCTestCase { } } - AssertBuildResult( + assertBuildResult( buildable, """ class Foo { @@ -41,7 +41,7 @@ final class ClassDeclSyntaxTests: XCTestCase { } } - AssertBuildResult( + assertBuildResult( buildable, """ class Foo { diff --git a/Tests/SwiftSyntaxBuilderTest/ClosureExprTests.swift b/Tests/SwiftSyntaxBuilderTest/ClosureExprTests.swift index 439c8553aaa..60b529bb246 100644 --- a/Tests/SwiftSyntaxBuilderTest/ClosureExprTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/ClosureExprTests.swift @@ -26,7 +26,7 @@ final class ClosureExprTests: XCTestCase { ) ) {} - AssertBuildResult( + assertBuildResult( buildable, """ {area in diff --git a/Tests/SwiftSyntaxBuilderTest/CollectionNodeFlatteningTests.swift b/Tests/SwiftSyntaxBuilderTest/CollectionNodeFlatteningTests.swift index fce40779cb2..74a3ecfa7a0 100644 --- a/Tests/SwiftSyntaxBuilderTest/CollectionNodeFlatteningTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/CollectionNodeFlatteningTests.swift @@ -35,7 +35,7 @@ final class CollectionNodeFlatteningTests: XCTestCase { buildOuterCodeBlockItemList() } - AssertBuildResult( + assertBuildResult( codeBlock, """ ␣{ diff --git a/Tests/SwiftSyntaxBuilderTest/CustomAttributeTests.swift b/Tests/SwiftSyntaxBuilderTest/CustomAttributeTests.swift index 6c1dc8fe61c..da7c28755e9 100644 --- a/Tests/SwiftSyntaxBuilderTest/CustomAttributeTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/CustomAttributeTests.swift @@ -29,7 +29,7 @@ final class CustomAttributeTests: XCTestCase { for (line, testCase) in testCases { let (builder, expected) = testCase - AssertBuildResult(builder, expected, line: line) + assertBuildResult(builder, expected, line: line) } } } diff --git a/Tests/SwiftSyntaxBuilderTest/DictionaryExprTests.swift b/Tests/SwiftSyntaxBuilderTest/DictionaryExprTests.swift index 5905f32bc46..05a004dd6f5 100644 --- a/Tests/SwiftSyntaxBuilderTest/DictionaryExprTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/DictionaryExprTests.swift @@ -21,12 +21,12 @@ final class DictionaryExprTests: XCTestCase { DictionaryElementSyntax(keyExpression: IntegerLiteralExprSyntax(i), valueExpression: IntegerLiteralExprSyntax(i)) } } - AssertBuildResult(buildable, "[1: 1, 2: 2, 3: 3]") + assertBuildResult(buildable, "[1: 1, 2: 2, 3: 3]") } func testEmptyDictionaryExpr() { let buildable = DictionaryExprSyntax() - AssertBuildResult(buildable, "[:]") + assertBuildResult(buildable, "[:]") } func testMultilineDictionaryLiteral() { @@ -41,7 +41,7 @@ final class DictionaryExprTests: XCTestCase { ] """ ) - AssertBuildResult( + assertBuildResult( builder, """ [ diff --git a/Tests/SwiftSyntaxBuilderTest/DoStmtTests.swift b/Tests/SwiftSyntaxBuilderTest/DoStmtTests.swift index 19e4a4d86ac..2e46b2d882f 100644 --- a/Tests/SwiftSyntaxBuilderTest/DoStmtTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/DoStmtTests.swift @@ -49,7 +49,7 @@ final class DoStmtTests: XCTestCase { ] ) - AssertBuildResult( + assertBuildResult( buildable, """ do { @@ -99,7 +99,7 @@ final class DoStmtTests: XCTestCase { ] ) - AssertBuildResult( + assertBuildResult( buildable, """ do { @@ -149,7 +149,7 @@ final class DoStmtTests: XCTestCase { ] ) - AssertBuildResult( + assertBuildResult( buildable, """ do { diff --git a/Tests/SwiftSyntaxBuilderTest/EnumCaseElementTests.swift b/Tests/SwiftSyntaxBuilderTest/EnumCaseElementTests.swift index 046e61d83df..c12d26e8503 100644 --- a/Tests/SwiftSyntaxBuilderTest/EnumCaseElementTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/EnumCaseElementTests.swift @@ -41,7 +41,7 @@ final class EnumCaseElementTests: XCTestCase { ) } - AssertBuildResult( + assertBuildResult( buildable, """ ␣enum Greeting: String, Codable, Equatable { diff --git a/Tests/SwiftSyntaxBuilderTest/ExprListTests.swift b/Tests/SwiftSyntaxBuilderTest/ExprListTests.swift index 8c1645bf70d..6ac366ac0ab 100644 --- a/Tests/SwiftSyntaxBuilderTest/ExprListTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/ExprListTests.swift @@ -23,7 +23,7 @@ final class ExprListTests: XCTestCase { for (line, testCase) in testCases { let (builder, expected) = testCase - AssertBuildResult(builder, expected, line: line) + assertBuildResult(builder, expected, line: line) } } } diff --git a/Tests/SwiftSyntaxBuilderTest/ExtensionDeclTests.swift b/Tests/SwiftSyntaxBuilderTest/ExtensionDeclTests.swift index 65b9c8c842b..cf7b343037d 100644 --- a/Tests/SwiftSyntaxBuilderTest/ExtensionDeclTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/ExtensionDeclTests.swift @@ -40,7 +40,7 @@ final class ExtensionDeclTests: XCTestCase { members: MemberDeclBlockSyntax(members: members) ) - AssertBuildResult( + assertBuildResult( buildable, """ extension TokenSyntax { diff --git a/Tests/SwiftSyntaxBuilderTest/FloatLiteralTests.swift b/Tests/SwiftSyntaxBuilderTest/FloatLiteralTests.swift index f69b5cd543b..ac851c5aea0 100644 --- a/Tests/SwiftSyntaxBuilderTest/FloatLiteralTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/FloatLiteralTests.swift @@ -29,7 +29,7 @@ final class FloatLiteralTests: XCTestCase { for (line, testCase) in testCases { let (builder, expected) = testCase - AssertBuildResult(builder, expected, line: line) + assertBuildResult(builder, expected, line: line) } } } diff --git a/Tests/SwiftSyntaxBuilderTest/FunctionTests.swift b/Tests/SwiftSyntaxBuilderTest/FunctionTests.swift index 9738cd876a8..9f5a8cd6874 100644 --- a/Tests/SwiftSyntaxBuilderTest/FunctionTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/FunctionTests.swift @@ -24,7 +24,7 @@ final class FunctionTests: XCTestCase { StmtSyntax("return fibonacci(n - 1) + self.fibonacci(n - 2)") } - AssertBuildResult( + assertBuildResult( buildable, """ func fibonacci(_ n: Int) -> Int { @@ -239,7 +239,7 @@ final class FunctionTests: XCTestCase { for (line, testCase) in testCases { let (builder, expected) = testCase - AssertBuildResult(builder, expected, line: line) + assertBuildResult(builder, expected, line: line) } } @@ -249,7 +249,7 @@ final class FunctionTests: XCTestCase { TupleExprElementSyntax(label: param.isMultiple(of: 2) ? "p\(param)" : nil, expression: ExprSyntax("value\(raw: param)")) } } - AssertBuildResult(buildable, "test(value1, p2: value2, value3, p4: value4, value5)") + assertBuildResult(buildable, "test(value1, p2: value2, value3, p4: value4, value5)") } func testFunctionDeclBuilder() { @@ -261,7 +261,7 @@ final class FunctionTests: XCTestCase { """ ) - AssertBuildResult( + assertBuildResult( builder, """ func test(_ p1: Int, p2: Int, _ p3: Int, p4: Int, _ p5: Int) -> Int { @@ -286,7 +286,7 @@ final class FunctionTests: XCTestCase { """ ) - AssertBuildResult( + assertBuildResult( builder, """ func test( @@ -315,7 +315,7 @@ final class FunctionTests: XCTestCase { """ ) - AssertBuildResult( + assertBuildResult( builder, """ test( @@ -331,14 +331,14 @@ final class FunctionTests: XCTestCase { func testParensEmittedForNoArgumentsAndNoTrailingClosure() { let buildable = FunctionCallExprSyntax(callee: ExprSyntax("test")) - AssertBuildResult(buildable, "test()") + assertBuildResult(buildable, "test()") } func testParensEmittedForArgumentAndTrailingClosure() { let buildable = FunctionCallExprSyntax(callee: ExprSyntax("test"), trailingClosure: ClosureExprSyntax {}) { TupleExprElementSyntax(expression: ExprSyntax("42")) } - AssertBuildResult(buildable, "test(42) {\n}") + assertBuildResult(buildable, "test(42) {\n}") } func testParensOmittedForNoArgumentsAndTrailingClosure() { @@ -349,7 +349,7 @@ final class FunctionTests: XCTestCase { }) let buildable = FunctionCallExprSyntax(callee: ExprSyntax("test"), trailingClosure: closure) - AssertBuildResult( + assertBuildResult( buildable, """ test { diff --git a/Tests/SwiftSyntaxBuilderTest/IfConfigDeclSyntaxTests.swift b/Tests/SwiftSyntaxBuilderTest/IfConfigDeclSyntaxTests.swift index a95ba06a595..226bee15f34 100644 --- a/Tests/SwiftSyntaxBuilderTest/IfConfigDeclSyntaxTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/IfConfigDeclSyntaxTests.swift @@ -51,7 +51,7 @@ final class IfConfigDeclSyntaxTests: XCTestCase { poundEndif: .poundEndifKeyword(leadingTrivia: .newline) ) - AssertBuildResult( + assertBuildResult( buildable, """ #if DEBUG diff --git a/Tests/SwiftSyntaxBuilderTest/IfStmtTests.swift b/Tests/SwiftSyntaxBuilderTest/IfStmtTests.swift index 3d3df15f62d..4b4f20bd27a 100644 --- a/Tests/SwiftSyntaxBuilderTest/IfStmtTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/IfStmtTests.swift @@ -20,7 +20,7 @@ final class IfStmtTests: XCTestCase { // disambiguated by the absence of a labelName parameter and the use of a // trailing closure. let buildable = IfExprSyntax(conditions: ConditionElementListSyntax { BooleanLiteralExprSyntax(false) }) {} - AssertBuildResult( + assertBuildResult( buildable, """ if false { @@ -81,7 +81,7 @@ final class IfStmtTests: XCTestCase { for (line, testCase) in testCases { let (builder, expected) = testCase - AssertBuildResult(builder, expected, line: line) + assertBuildResult(builder, expected, line: line) } } @@ -110,7 +110,7 @@ final class IfStmtTests: XCTestCase { for (line, testCase) in testCases { let (builder, expected) = testCase - AssertBuildResult(builder, expected, line: line) + assertBuildResult(builder, expected, line: line) } } @@ -124,7 +124,7 @@ final class IfStmtTests: XCTestCase { ) } ) {} - AssertBuildResult( + assertBuildResult( buildable, """ if let x = y { @@ -142,7 +142,7 @@ final class IfStmtTests: XCTestCase { ) } ) {} - AssertBuildResult( + assertBuildResult( buildable, """ if case .x = y { diff --git a/Tests/SwiftSyntaxBuilderTest/ImportTests.swift b/Tests/SwiftSyntaxBuilderTest/ImportTests.swift index 7270d1da5c9..f52210ed1ea 100644 --- a/Tests/SwiftSyntaxBuilderTest/ImportTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/ImportTests.swift @@ -24,6 +24,6 @@ final class ImportTests: XCTestCase { path: AccessPathSyntax([AccessPathComponentSyntax(name: identifier)]) ) - AssertBuildResult(importDecl, "␣import SwiftSyntax") + assertBuildResult(importDecl, "␣import SwiftSyntax") } } diff --git a/Tests/SwiftSyntaxBuilderTest/InitializerDeclTests.swift b/Tests/SwiftSyntaxBuilderTest/InitializerDeclTests.swift index 2ca6bde8015..bc80a703c5d 100644 --- a/Tests/SwiftSyntaxBuilderTest/InitializerDeclTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/InitializerDeclTests.swift @@ -24,7 +24,7 @@ final class InitializerDeclTests: XCTestCase { """ ) - AssertBuildResult( + assertBuildResult( builder, """ public init(errorCode: Int) { @@ -44,7 +44,7 @@ final class InitializerDeclTests: XCTestCase { """ ) - AssertBuildResult( + assertBuildResult( builder, """ public init?(errorCode: Int) { @@ -72,7 +72,7 @@ final class InitializerDeclTests: XCTestCase { """ ) - AssertBuildResult( + assertBuildResult( builder, """ init( diff --git a/Tests/SwiftSyntaxBuilderTest/IntegerLiteralTests.swift b/Tests/SwiftSyntaxBuilderTest/IntegerLiteralTests.swift index c2f1491dfdd..f3daa2e8a7e 100644 --- a/Tests/SwiftSyntaxBuilderTest/IntegerLiteralTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/IntegerLiteralTests.swift @@ -29,7 +29,7 @@ final class IntegerLiteralTests: XCTestCase { for (line, testCase) in testCases { let (builder, expected) = testCase - AssertBuildResult(builder, expected, line: line) + assertBuildResult(builder, expected, line: line) } } } diff --git a/Tests/SwiftSyntaxBuilderTest/ProtocolDeclTests.swift b/Tests/SwiftSyntaxBuilderTest/ProtocolDeclTests.swift index 0d803aa6e16..164ca330296 100644 --- a/Tests/SwiftSyntaxBuilderTest/ProtocolDeclTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/ProtocolDeclTests.swift @@ -20,7 +20,7 @@ final class ProtocolDeclTests: XCTestCase { DeclSyntax("func buildDeclList(format: Format, leadingTrivia: Trivia?) -> [DeclSyntax]") } - AssertBuildResult( + assertBuildResult( buildable, """ public protocol DeclListBuildable { diff --git a/Tests/SwiftSyntaxBuilderTest/ReturnStmsTests.swift b/Tests/SwiftSyntaxBuilderTest/ReturnStmsTests.swift index 239253fed33..b7bfd7fc956 100644 --- a/Tests/SwiftSyntaxBuilderTest/ReturnStmsTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/ReturnStmsTests.swift @@ -45,7 +45,7 @@ final class ReturnStmtTests: XCTestCase { for (line, testCase) in testCases { let (builder, expected) = testCase - AssertBuildResult(builder, expected, line: line) + assertBuildResult(builder, expected, line: line) } } } diff --git a/Tests/SwiftSyntaxBuilderTest/SourceFileTests.swift b/Tests/SwiftSyntaxBuilderTest/SourceFileTests.swift index 1ad9d4778d0..e0ab8f9678e 100644 --- a/Tests/SwiftSyntaxBuilderTest/SourceFileTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/SourceFileTests.swift @@ -28,7 +28,7 @@ final class SourceFileTests: XCTestCase { ) } - AssertBuildResult( + assertBuildResult( source, """ import Foundation diff --git a/Tests/SwiftSyntaxBuilderTest/StringInterpolationTests.swift b/Tests/SwiftSyntaxBuilderTest/StringInterpolationTests.swift index dbba9a4b528..bc0106bd26e 100644 --- a/Tests/SwiftSyntaxBuilderTest/StringInterpolationTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/StringInterpolationTests.swift @@ -105,32 +105,32 @@ final class StringInterpolationTests: XCTestCase { func testInterpolationLiteralString() { let a: ExprSyntax = "print(\(literal: "Hello, world!"))" - AssertStringsEqualWithDiff(a.description, #"print("Hello, world!")"#) + assertStringsEqualWithDiff(a.description, #"print("Hello, world!")"#) let b: ExprSyntax = "print(\(literal: "\"Hello\", world!"))" - AssertStringsEqualWithDiff(b.description, ##"print(#""Hello", world!"#)"##) + assertStringsEqualWithDiff(b.description, ##"print(#""Hello", world!"#)"##) let c: ExprSyntax = "print(\(literal: "Hello\\#\\world!"))" - AssertStringsEqualWithDiff(c.description, ###"print(##"Hello\#\world!"##)"###) + assertStringsEqualWithDiff(c.description, ###"print(##"Hello\#\world!"##)"###) let d: ExprSyntax = "print(\(literal: "Hello, world!\n"))" - AssertStringsEqualWithDiff(d.description, #"print("Hello, world!\n")"#) + assertStringsEqualWithDiff(d.description, #"print("Hello, world!\n")"#) let e: ExprSyntax = "print(\(literal: "\"Hello\", world!\n"))" - AssertStringsEqualWithDiff(e.description, ##"print(#""Hello", world!\#n"#)"##) + assertStringsEqualWithDiff(e.description, ##"print(#""Hello", world!\#n"#)"##) } func testInterpolationLiteralInt() { func test(with ty: T.Type, unsigned: Bool = false) { let a: ExprSyntax = "print(\(literal: 42 as T))" - AssertStringsEqualWithDiff(a.description, #"print(42)"#, additionalInfo: String(describing: ty)) + assertStringsEqualWithDiff(a.description, #"print(42)"#, additionalInfo: String(describing: ty)) let b: ExprSyntax = "print(\(literal: 0 as T))" - AssertStringsEqualWithDiff(b.description, #"print(0)"#, additionalInfo: String(describing: ty)) + assertStringsEqualWithDiff(b.description, #"print(0)"#, additionalInfo: String(describing: ty)) if !unsigned { let c: ExprSyntax = "print(\(literal: -42 as T))" - AssertStringsEqualWithDiff(c.description, ##"print(-42)"##, additionalInfo: String(describing: ty)) + assertStringsEqualWithDiff(c.description, ##"print(-42)"##, additionalInfo: String(describing: ty)) } } @@ -149,28 +149,28 @@ final class StringInterpolationTests: XCTestCase { func testInterpolationLiteralFloat() { func test(with ty: T.Type) { let a: ExprSyntax = "print(\(literal: 3.14 as T))" - AssertStringsEqualWithDiff(a.description, #"print(3.14)"#, additionalInfo: String(describing: ty)) + assertStringsEqualWithDiff(a.description, #"print(3.14)"#, additionalInfo: String(describing: ty)) let b: ExprSyntax = "print(\(literal: 0 as T))" - AssertStringsEqualWithDiff(b.description, #"print(0.0)"#, additionalInfo: String(describing: ty)) + assertStringsEqualWithDiff(b.description, #"print(0.0)"#, additionalInfo: String(describing: ty)) let c: ExprSyntax = "print(\(literal: -42 as T))" - AssertStringsEqualWithDiff(c.description, ##"print(-42.0)"##, additionalInfo: String(describing: ty)) + assertStringsEqualWithDiff(c.description, ##"print(-42.0)"##, additionalInfo: String(describing: ty)) let d: ExprSyntax = "print(\(literal: T.infinity))" - AssertStringsEqualWithDiff(d.description, ##"print(.infinity)"##, additionalInfo: String(describing: ty)) + assertStringsEqualWithDiff(d.description, ##"print(.infinity)"##, additionalInfo: String(describing: ty)) let e: ExprSyntax = "print(\(literal: -T.infinity))" - AssertStringsEqualWithDiff(e.description, ##"print(-.infinity)"##, additionalInfo: String(describing: ty)) + assertStringsEqualWithDiff(e.description, ##"print(-.infinity)"##, additionalInfo: String(describing: ty)) let f: ExprSyntax = "print(\(literal: T.nan))" - AssertStringsEqualWithDiff(f.description, ##"print(.nan)"##, additionalInfo: String(describing: ty)) + assertStringsEqualWithDiff(f.description, ##"print(.nan)"##, additionalInfo: String(describing: ty)) let g: ExprSyntax = "print(\(literal: T.signalingNaN))" - AssertStringsEqualWithDiff(g.description, ##"print(.signalingNaN)"##, additionalInfo: String(describing: ty)) + assertStringsEqualWithDiff(g.description, ##"print(.signalingNaN)"##, additionalInfo: String(describing: ty)) let h: ExprSyntax = "print(\(literal: -0.0 as T))" - AssertStringsEqualWithDiff(h.description, ##"print(-0.0)"##, additionalInfo: String(describing: ty)) + assertStringsEqualWithDiff(h.description, ##"print(-0.0)"##, additionalInfo: String(describing: ty)) } test(with: Float.self) @@ -179,24 +179,24 @@ final class StringInterpolationTests: XCTestCase { func testInterpolationLiteralBool() { let a: ExprSyntax = "print(\(literal: true))" - AssertStringsEqualWithDiff(a.description, #"print(true)"#) + assertStringsEqualWithDiff(a.description, #"print(true)"#) let b: ExprSyntax = "print(\(literal: false))" - AssertStringsEqualWithDiff(b.description, #"print(false)"#) + assertStringsEqualWithDiff(b.description, #"print(false)"#) } func testInterpolationLiteralCollections() { let a: ExprSyntax = "print(\(literal: [3, 2, 1]))" - AssertStringsEqualWithDiff(a.description, #"print([3, 2, 1])"#) + assertStringsEqualWithDiff(a.description, #"print([3, 2, 1])"#) let b: ExprSyntax = "print(\(literal: [3, 2, 1] as Set))" - AssertStringsEqualWithDiff(b.description, #"print([1, 2, 3])"#) + assertStringsEqualWithDiff(b.description, #"print([1, 2, 3])"#) let c: ExprSyntax = "print(\(literal: [3: "three", 2: "two", 1: "one"] as KeyValuePairs))" - AssertStringsEqualWithDiff(c.description, #"print([3: "three", 2: "two", 1: "one"])"#) + assertStringsEqualWithDiff(c.description, #"print([3: "three", 2: "two", 1: "one"])"#) let d: ExprSyntax = "print(\(literal: [3: "three", 2: "two", 1: "one"]))" - AssertStringsEqualWithDiff(d.description, #"print([1: "one", 2: "two", 3: "three"])"#) + assertStringsEqualWithDiff(d.description, #"print([1: "one", 2: "two", 3: "three"])"#) } func testInterpolationLiteralOptional() { @@ -204,19 +204,19 @@ final class StringInterpolationTests: XCTestCase { let none: Optional = nil let a: ExprSyntax = "print(\(literal: some))" - AssertStringsEqualWithDiff(a.description, #"print(42)"#) + assertStringsEqualWithDiff(a.description, #"print(42)"#) let b: ExprSyntax = "print(\(literal: Optional.some(some)))" - AssertStringsEqualWithDiff(b.description, #"print(42)"#) + assertStringsEqualWithDiff(b.description, #"print(42)"#) let c: ExprSyntax = "print(\(literal: none))" - AssertStringsEqualWithDiff(c.description, #"print(nil)"#) + assertStringsEqualWithDiff(c.description, #"print(nil)"#) let d: ExprSyntax = "print(\(literal: Optional.some(none)))" - AssertStringsEqualWithDiff(d.description, #"print(.some(nil))"#) + assertStringsEqualWithDiff(d.description, #"print(.some(nil))"#) let e: ExprSyntax = "print(\(literal: Int??.none))" - AssertStringsEqualWithDiff(e.description, #"print(nil)"#) + assertStringsEqualWithDiff(e.description, #"print(nil)"#) } func testRewriter() { @@ -273,7 +273,7 @@ final class StringInterpolationTests: XCTestCase { """ ) - AssertStringsEqualWithDiff( + assertStringsEqualWithDiff( plusOne.description.trimmingTrailingWhitespace(), """ func plusOne(base: Int) -> Int { @@ -317,7 +317,7 @@ final class StringInterpolationTests: XCTestCase { """ ) - AssertStringsEqualWithDiff( + assertStringsEqualWithDiff( plusOne.description.trimmingTrailingWhitespace(), """ func plusOne(base: Int) -> Int { @@ -346,7 +346,7 @@ final class StringInterpolationTests: XCTestCase { """ ) } - AssertStringsEqualWithDiff( + assertStringsEqualWithDiff( ext.formatted(using: TwoSpacesFormat()).description, """ extension MyType { @@ -368,7 +368,7 @@ final class StringInterpolationTests: XCTestCase { } """ XCTAssertTrue(setter.is(AccessorDeclSyntax.self)) - AssertStringsEqualWithDiff( + assertStringsEqualWithDiff( setter.description, """ set(newValue) { @@ -413,7 +413,7 @@ final class StringInterpolationTests: XCTestCase { XCTAssertEqual(invalid, [.blockComment("/*comment*/"), .spaces(1), .unexpectedText("invalid"), .spaces(1), .blockComment("/*comm*/")]) XCTAssertThrowsError(try Trivia(validating: "/*comment*/ invalid /*comm*/")) { error in - AssertStringsEqualWithDiff( + assertStringsEqualWithDiff( String(describing: error), """ @@ -430,7 +430,7 @@ final class StringInterpolationTests: XCTestCase { XCTAssert(invalid.hasError) XCTAssertThrowsError(try DeclSyntax(validating: "return 1")) { error in - AssertStringsEqualWithDiff( + assertStringsEqualWithDiff( String(describing: error), """ @@ -448,7 +448,7 @@ final class StringInterpolationTests: XCTestCase { XCTAssert(invalid.hasError) XCTAssertThrowsError(try StmtSyntax(validating: "struct Foo {}")) { error in - AssertStringsEqualWithDiff( + assertStringsEqualWithDiff( String(describing: error), """ diff --git a/Tests/SwiftSyntaxBuilderTest/StringLiteralTests.swift b/Tests/SwiftSyntaxBuilderTest/StringLiteralTests.swift index 0770bdbbb67..2311fbcd50a 100644 --- a/Tests/SwiftSyntaxBuilderTest/StringLiteralTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/StringLiteralTests.swift @@ -33,19 +33,19 @@ final class StringLiteralTests: XCTestCase { closeQuote: .stringQuoteToken() ) - AssertBuildResult(builder, expected, line: line) + assertBuildResult(builder, expected, line: line) } } func testRegular() { - AssertBuildResult( + assertBuildResult( StringLiteralExprSyntax(content: "foobar"), """ "foobar" """ ) - AssertBuildResult( + assertBuildResult( StringLiteralExprSyntax(content: "##foobar"), """ "##foobar" @@ -54,7 +54,7 @@ final class StringLiteralTests: XCTestCase { } func testEscapeLiteral() { - AssertBuildResult( + assertBuildResult( StringLiteralExprSyntax(content: #""""foobar""#), ##""" #""""foobar""# @@ -63,7 +63,7 @@ final class StringLiteralTests: XCTestCase { } func testEscapePounds() { - AssertBuildResult( + assertBuildResult( StringLiteralExprSyntax(content: ###"#####"foobar"##foobar"#foobar"###), #####""" ###"#####"foobar"##foobar"#foobar"### @@ -72,7 +72,7 @@ final class StringLiteralTests: XCTestCase { } func testEscapeInteropolation() { - AssertBuildResult( + assertBuildResult( StringLiteralExprSyntax(content: ###"\##(foobar)\#(foobar)"###), ####""" ###"\##(foobar)\#(foobar)"### @@ -81,28 +81,28 @@ final class StringLiteralTests: XCTestCase { } func testEscapeBackslash() { - AssertBuildResult( + assertBuildResult( StringLiteralExprSyntax(content: #"\"#), ##""" #"\"# """## ) - AssertBuildResult( + assertBuildResult( StringLiteralExprSyntax(content: ##"\#n"##), ##""" ##"\#n"## """## ) - AssertBuildResult( + assertBuildResult( StringLiteralExprSyntax(content: ##"\#\"##), ##""" ##"\#\"## """## ) - AssertBuildResult( + assertBuildResult( StringLiteralExprSyntax(content: ##"\#"##), ##""" ##"\#"## @@ -111,24 +111,24 @@ final class StringLiteralTests: XCTestCase { } func testNewlines() { - AssertBuildResult( + assertBuildResult( StringLiteralExprSyntax(content: "linux\nwindows\r\nunicode\u{2028}a"), #""linux\nwindows\r\nunicode\u{2028}a""# ) - AssertBuildResult( + assertBuildResult( StringLiteralExprSyntax(content: "\\linux\nwindows\r\nunicode\u{2028}a"), ##"#"\linux\#nwindows\#r\#nunicode\#u{2028}a"#"## ) } func testNul() { - AssertBuildResult( + assertBuildResult( StringLiteralExprSyntax(content: "before\0after"), #""before\0after""# ) - AssertBuildResult( + assertBuildResult( StringLiteralExprSyntax(content: "\\before\0after"), ##"#"\before\#0after"#"## ) @@ -136,12 +136,12 @@ final class StringLiteralTests: XCTestCase { func testControlChars() { // Note that tabs do *not* get escaped. - AssertBuildResult( + assertBuildResult( StringLiteralExprSyntax(content: "before\u{07}\t\u{7f}after"), #""before\u{7}\t\u{7f}after""# ) - AssertBuildResult( + assertBuildResult( StringLiteralExprSyntax(content: "\\before\u{07}\t\u{7f}after"), ##"#"\before\#u{7}\#t\#u{7f}after"#"## ) @@ -149,7 +149,7 @@ final class StringLiteralTests: XCTestCase { func testEscapeTab() { // Tab should be escaped in single-line string literals - AssertBuildResult( + assertBuildResult( StringLiteralExprSyntax(content: "a\tb"), #""" "a\tb" @@ -157,7 +157,7 @@ final class StringLiteralTests: XCTestCase { ) // Tab should not be escaped in single-line string literals - AssertBuildResult( + assertBuildResult( StringLiteralExprSyntax( openQuote: .multilineStringQuoteToken(trailingTrivia: .newline), content: "a\tb", @@ -178,7 +178,7 @@ final class StringLiteralTests: XCTestCase { """# ) - AssertBuildResult( + assertBuildResult( buildable, #""" "Validation failures: \(nonNilErrors.map({ "- \($0.description)" }).joined(separator: "\n"))" @@ -189,7 +189,7 @@ final class StringLiteralTests: XCTestCase { func testStringSegmentWithCode() { let buildable = StringSegmentSyntax(content: .stringSegment(#"\(nonNilErrors.map({ "- \($0.description)" }).joined(separator: "\n"))"#)) - AssertBuildResult( + assertBuildResult( buildable, #"\(nonNilErrors.map({ "- \($0.description)" }).joined(separator: "\n"))"# ) @@ -203,7 +203,7 @@ final class StringLiteralTests: XCTestCase { StringSegmentSyntax(content: .stringSegment(#"\(nonNilErrors.map({ "- \($0.description)" }).joined(separator: "\n"))"#)) } - AssertBuildResult( + assertBuildResult( buildable, #""" Error validating child at index \(index) of \(nodeKind): @@ -230,7 +230,7 @@ final class StringLiteralTests: XCTestCase { closeQuote: .multilineStringQuoteToken(leadingTrivia: .newline) ) - AssertBuildResult( + assertBuildResult( buildable, #""" """ @@ -255,7 +255,7 @@ final class StringLiteralTests: XCTestCase { """# ) - AssertBuildResult( + assertBuildResult( buildable, #""" assertionFailure(""" @@ -281,7 +281,7 @@ final class StringLiteralTests: XCTestCase { """# ) - AssertBuildResult( + assertBuildResult( buildable, #""" if true { @@ -310,7 +310,7 @@ final class StringLiteralTests: XCTestCase { """# ) - AssertBuildResult( + assertBuildResult( buildable, #""" if true { diff --git a/Tests/SwiftSyntaxBuilderTest/StructTests.swift b/Tests/SwiftSyntaxBuilderTest/StructTests.swift index 2c29afc68ed..467e456c84c 100644 --- a/Tests/SwiftSyntaxBuilderTest/StructTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/StructTests.swift @@ -19,7 +19,7 @@ final class StructTests: XCTestCase { let leadingTrivia = Trivia.unexpectedText("␣") let buildable = StructDeclSyntax(leadingTrivia: leadingTrivia, identifier: "TestStruct") {} - AssertBuildResult( + assertBuildResult( buildable, """ ␣struct TestStruct { @@ -65,7 +65,7 @@ final class StructTests: XCTestCase { carriageReturnFormFeedsStruct } - AssertBuildResult( + assertBuildResult( testStruct, """ public struct TestStruct { @@ -99,7 +99,7 @@ final class StructTests: XCTestCase { } } } - AssertBuildResult( + assertBuildResult( myStruct, """ struct MyStruct { diff --git a/Tests/SwiftSyntaxBuilderTest/SwitchCaseLabelSyntaxTests.swift b/Tests/SwiftSyntaxBuilderTest/SwitchCaseLabelSyntaxTests.swift index 61cd1118202..52d88915504 100644 --- a/Tests/SwiftSyntaxBuilderTest/SwitchCaseLabelSyntaxTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/SwitchCaseLabelSyntaxTests.swift @@ -41,7 +41,7 @@ final class SwitchCaseLabelSyntaxTests: XCTestCase { for (line, testCase) in testCases { let (builder, expected) = testCase - AssertBuildResult(builder, expected, trimTrailingWhitespace: false, line: line) + assertBuildResult(builder, expected, trimTrailingWhitespace: false, line: line) } } } diff --git a/Tests/SwiftSyntaxBuilderTest/SwitchTests.swift b/Tests/SwiftSyntaxBuilderTest/SwitchTests.swift index 2ce78850ecf..093d9b7f0b8 100644 --- a/Tests/SwiftSyntaxBuilderTest/SwitchTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/SwitchTests.swift @@ -27,7 +27,7 @@ final class SwitchTests: XCTestCase { } } - AssertBuildResult( + assertBuildResult( syntax, """ switch count { @@ -54,7 +54,7 @@ final class SwitchTests: XCTestCase { } } - AssertBuildResult( + assertBuildResult( syntax, """ switch count { diff --git a/Tests/SwiftSyntaxBuilderTest/TernaryExprTests.swift b/Tests/SwiftSyntaxBuilderTest/TernaryExprTests.swift index e300afa011a..ba6521c0abe 100644 --- a/Tests/SwiftSyntaxBuilderTest/TernaryExprTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/TernaryExprTests.swift @@ -17,7 +17,7 @@ import SwiftSyntaxBuilder final class TernaryExprTests: XCTestCase { func testTernaryExpr() { let buildable = ExprSyntax("true ? a : b") - AssertBuildResult( + assertBuildResult( buildable, """ true ? a : b diff --git a/Tests/SwiftSyntaxBuilderTest/TriviaTests.swift b/Tests/SwiftSyntaxBuilderTest/TriviaTests.swift index a8bfb35e67d..ba1e3368ece 100644 --- a/Tests/SwiftSyntaxBuilderTest/TriviaTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/TriviaTests.swift @@ -36,7 +36,7 @@ final class TriviaTests: XCTestCase { ) } - AssertBuildResult( + assertBuildResult( decl, """ /// A doc comment @@ -66,7 +66,7 @@ final class TriviaTests: XCTestCase { ] for (line, testCase) in testCases { let (builder, expected) = testCase - AssertBuildResult(builder, expected, line: line) + assertBuildResult(builder, expected, line: line) } } @@ -88,7 +88,7 @@ final class TriviaTests: XCTestCase { ] for (line, testCase) in testCases { let (builder, expected) = testCase - AssertBuildResult(builder, expected, line: line) + assertBuildResult(builder, expected, line: line) } } } diff --git a/Tests/SwiftSyntaxBuilderTest/TupleTests.swift b/Tests/SwiftSyntaxBuilderTest/TupleTests.swift index d60082e5cff..5d4d36244af 100644 --- a/Tests/SwiftSyntaxBuilderTest/TupleTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/TupleTests.swift @@ -17,7 +17,7 @@ import SwiftSyntaxBuilder final class TupleTests: XCTestCase { func testLabeledElementList() { let builder = ExprSyntax("(p1: value1, p2: value2, p3: value3)") - AssertBuildResult(builder, "(p1: value1, p2: value2, p3: value3)") + assertBuildResult(builder, "(p1: value1, p2: value2, p3: value3)") } func testMultilineTupleExpr() { @@ -33,7 +33,7 @@ final class TupleTests: XCTestCase { """ ) - AssertBuildResult( + assertBuildResult( builder, """ ( @@ -60,7 +60,7 @@ final class TupleTests: XCTestCase { """ ) - AssertBuildResult( + assertBuildResult( builder, """ ( diff --git a/Tests/SwiftSyntaxBuilderTest/VariableTests.swift b/Tests/SwiftSyntaxBuilderTest/VariableTests.swift index 147bc45816b..ab949e7b192 100644 --- a/Tests/SwiftSyntaxBuilderTest/VariableTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/VariableTests.swift @@ -22,7 +22,7 @@ final class VariableTests: XCTestCase { PatternBindingSyntax(pattern: PatternSyntax("a"), typeAnnotation: TypeAnnotationSyntax(type: ArrayTypeSyntax(elementType: TypeSyntax("Int")))) } - AssertBuildResult(buildable, "␣let a: [Int]") + assertBuildResult(buildable, "␣let a: [Int]") } func testInoutBindingDecl() { @@ -32,7 +32,7 @@ final class VariableTests: XCTestCase { PatternBindingSyntax(pattern: PatternSyntax("a"), typeAnnotation: TypeAnnotationSyntax(type: ArrayTypeSyntax(elementType: TypeSyntax("Int")))) } - AssertBuildResult(buildable, "␣inout a: [Int]") + assertBuildResult(buildable, "␣inout a: [Int]") } func testVariableDeclWithStringParsing() { @@ -151,7 +151,7 @@ final class VariableTests: XCTestCase { for (line, testCase) in testCases { let (builder, expected) = testCase - AssertBuildResult(builder, expected, line: line) + assertBuildResult(builder, expected, line: line) } } @@ -166,7 +166,7 @@ final class VariableTests: XCTestCase { ) } - AssertBuildResult(buildable, "␣var d: [String: Int] = [:]") + assertBuildResult(buildable, "␣var d: [String: Int] = [:]") } func testVariableDeclWithExplicitTrailingCommas() { @@ -188,7 +188,7 @@ final class VariableTests: XCTestCase { ) ] ) - AssertBuildResult( + assertBuildResult( buildable, """ let a = [1, 2, 3, ] @@ -221,7 +221,7 @@ final class VariableTests: XCTestCase { PatternBindingSyntax(pattern: PatternSyntax("i"), typeAnnotation: TypeAnnotationSyntax(type: TypeSyntax("Int"))) PatternBindingSyntax(pattern: PatternSyntax("s"), typeAnnotation: TypeAnnotationSyntax(type: TypeSyntax("String"))) } - AssertBuildResult(buildable, #"let a = [1, 2, 3], d = ["key1": 1, "key2": 2, "key3": 3], i: Int, s: String"#) + assertBuildResult(buildable, #"let a = [1, 2, 3], d = ["key1": 1, "key2": 2, "key3": 3], i: Int, s: String"#) } func testClosureTypeVariableDecl() { @@ -229,7 +229,7 @@ final class VariableTests: XCTestCase { let buildable = VariableDeclSyntax(bindingKeyword: .keyword(.let)) { PatternBindingSyntax(pattern: PatternSyntax("c"), typeAnnotation: TypeAnnotationSyntax(type: type)) } - AssertBuildResult(buildable, "let c: (Int) -> Bool") + assertBuildResult(buildable, "let c: (Int) -> Bool") } func testComputedProperty() throws { @@ -262,7 +262,7 @@ final class VariableTests: XCTestCase { for (line, testCase) in testCases { let (builder, expected) = testCase - AssertBuildResult(builder, expected, line: line) + assertBuildResult(builder, expected, line: line) } } @@ -279,7 +279,7 @@ final class VariableTests: XCTestCase { AccessorDeclSyntax(accessorKind: .keyword(.willSet)) {} } - AssertBuildResult( + assertBuildResult( buildable, """ var test: Int { @@ -346,7 +346,7 @@ final class VariableTests: XCTestCase { for (line, testCase) in testCases { let (builder, expected) = testCase - AssertBuildResult(builder, expected, line: line) + assertBuildResult(builder, expected, line: line) } } } diff --git a/Tests/SwiftSyntaxMacrosTest/MacroReplacementTests.swift b/Tests/SwiftSyntaxMacrosTest/MacroReplacementTests.swift index 3ddf8a9d153..c884a7c88ba 100644 --- a/Tests/SwiftSyntaxMacrosTest/MacroReplacementTests.swift +++ b/Tests/SwiftSyntaxMacrosTest/MacroReplacementTests.swift @@ -107,7 +107,7 @@ final class MacroReplacementTests: XCTestCase { definition: expansion, replacements: replacements ) - AssertStringsEqualWithDiff( + assertStringsEqualWithDiff( expandedSyntax.description, """ #otherMacro(first: 17, second: ["a": 5], third: [3.14159, 2.71828], fourth: 4) diff --git a/Tests/SwiftSyntaxMacrosTest/MacroSystemTests.swift b/Tests/SwiftSyntaxMacrosTest/MacroSystemTests.swift index 5a6148c0bb4..5ce444d759a 100644 --- a/Tests/SwiftSyntaxMacrosTest/MacroSystemTests.swift +++ b/Tests/SwiftSyntaxMacrosTest/MacroSystemTests.swift @@ -633,7 +633,7 @@ extension CustomTypeWrapperMacro: AccessorMacro { /// macros in various places (e.g., `#stringify(x + y)`). /// - expandedSource: The source code that we expect to see after performing /// macro expansion on the original source. -public func AssertMacroExpansion( +public func assertMacroExpansion( macros: [String: Macro.Type], testModuleName: String = "TestModule", testFileName: String = "test.swift", @@ -652,7 +652,7 @@ public func AssertMacroExpansion( ) let expandedSourceFile = origSourceFile.expand(macros: macros, in: context) - AssertStringsEqualWithDiff( + assertStringsEqualWithDiff( expandedSourceFile.description, expandedSource, file: file, @@ -689,7 +689,7 @@ public let testMacros: [String: Macro.Type] = [ final class MacroSystemTests: XCTestCase { func testExpressionExpansion() { - AssertMacroExpansion( + assertMacroExpansion( macros: testMacros, """ let b = #stringify(x + y) @@ -703,7 +703,7 @@ final class MacroSystemTests: XCTestCase { } func testStringifyExpression() { - AssertMacroExpansion( + assertMacroExpansion( macros: ["stringify": StringifyMacro.self], """ _ = #stringify({ () -> Bool in @@ -721,7 +721,7 @@ final class MacroSystemTests: XCTestCase { } func testLocationExpansions() { - AssertMacroExpansion( + assertMacroExpansion( macros: testMacros, testModuleName: "MyModule", testFileName: "taylor.swift", @@ -747,7 +747,7 @@ final class MacroSystemTests: XCTestCase { } func testContextIndependence() { - AssertMacroExpansion( + assertMacroExpansion( macros: ["checkContext": CheckContextIndependenceMacro.self], """ let b = #checkContext @@ -759,7 +759,7 @@ final class MacroSystemTests: XCTestCase { } func testErrorExpansion() { - AssertMacroExpansion( + assertMacroExpansion( macros: testMacros, """ #myError("please don't do that") @@ -788,7 +788,7 @@ final class MacroSystemTests: XCTestCase { } func testBitwidthNumberedStructsExpansion() { - AssertMacroExpansion( + assertMacroExpansion( macros: testMacros, """ #bitwidthNumberedStructs("MyInt") @@ -804,7 +804,7 @@ final class MacroSystemTests: XCTestCase { } func testPropertyWrapper() { - AssertMacroExpansion( + assertMacroExpansion( macros: testMacros, """ @wrapProperty("MyWrapperType") @@ -826,7 +826,7 @@ final class MacroSystemTests: XCTestCase { } func testAddCompletionHandler() { - AssertMacroExpansion( + assertMacroExpansion( macros: testMacros, """ @addCompletionHandler @@ -846,7 +846,7 @@ final class MacroSystemTests: XCTestCase { } func testAddBackingStorage() { - AssertMacroExpansion( + assertMacroExpansion( macros: testMacros, """ @addBackingStorage @@ -865,7 +865,7 @@ final class MacroSystemTests: XCTestCase { } func testWrapAllProperties() { - AssertMacroExpansion( + assertMacroExpansion( macros: testMacros, """ @wrapAllProperties @@ -901,7 +901,7 @@ final class MacroSystemTests: XCTestCase { """ ) - AssertMacroExpansion( + assertMacroExpansion( macros: testMacros, """ @wrapStoredProperties @@ -941,7 +941,7 @@ final class MacroSystemTests: XCTestCase { } func testTypeWrapperTransform() { - AssertMacroExpansion( + assertMacroExpansion( macros: testMacros, """ @customTypeWrapper