Skip to content

Commit

Permalink
Revert "[Swift APIView] Add automated tests (Azure#9487)"
Browse files Browse the repository at this point in the history
This reverts commit e495310.
  • Loading branch information
lucianopa-msft committed Dec 10, 2024
1 parent 2c50f2f commit b21f8f3
Show file tree
Hide file tree
Showing 30 changed files with 24 additions and 1,798 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
</CommandLineArgument>
<CommandLineArgument
argument = "--source=/Users/travisprescott/Documents/AzureCommunicationCalling.xcframework"
isEnabled = "NO">
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "--source=/Users/travisprescott/repos/communication-ui-library-ios/AzureCommunicationUI"
Expand All @@ -68,12 +68,12 @@
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "--package-name=SwiftAPIViewTests"
argument = "--package-name=AzureCommunicationCallingTEST"
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "--source=/Users/travisprescott/repos/azure-sdk-tools/src/swift/SwiftAPIViewTests/Sources"
isEnabled = "YES">
isEnabled = "NO">
</CommandLineArgument>
</CommandLineArguments>
<LocationScenarioReference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,6 @@ class APIViewModel: Tokenizable, Encodable {
// self.diagnostics.append(Diagnostic(line_id, text))

func comment(_ text: String) {
checkIndent()
var message = text
if !text.starts(with: "\\") {
message = "\\\\ \(message)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,10 @@ class DeclarationModel: Tokenizable, Linkable, Equatable {
case .attributeList:
// attributes on declarations should have newlines
let obj = AttributeListSyntax(child)!
let children = obj.children(viewMode: .sourceAccurate)
for attr in children {
for attr in obj.children(viewMode: .sourceAccurate) {
attr.tokenize(apiview: a, parent: parent)
let attrText = attr.withoutTrivia().description.filter { !$0.isWhitespace }
a.lineIdMarker(definitionId: "\(definitionId!).\(attrText)")
attr.tokenize(apiview: a, parent: parent)
a.newline()
a.blankLines(set: 0)
}
case .token:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,32 +37,21 @@ extension SyntaxProtocol {
case .customAttribute: fallthrough
case .attribute:
// default implementation should not have newlines
let children = self.children(viewMode: .sourceAccurate)
for child in children {
for child in self.children(viewMode: .sourceAccurate) {
if child.childNameInParent == "name" {
let attrName = child.withoutTrivia().description
// don't add space if the attribute has parameters
a.keyword(attrName, spacing: children.count == 2 ? .Trailing : .Neither)
a.keyword(attrName, spacing: .Neither)
} else {
child.tokenize(apiview: a, parent: parent)
}
}
a.whitespace()
case .classRestrictionType:
// in this simple context, class should not have a trailing space
a.keyword("class", spacing: .Neither)
case .codeBlock:
// Don't render code blocks. APIView is unconcerned with implementation
break
case .constrainedSugarType:
let obj = ConstrainedSugarTypeSyntax(self)!
let children = obj.children(viewMode: .sourceAccurate)
assert(children.count == 2)
for child in children {
child.tokenize(apiview: a, parent: parent)
if (child.kind == .token) {
a.whitespace()
}
}
case .enumCaseElement:
for child in self.children(viewMode: .sourceAccurate) {
let childIndex = child.indexInParent
Expand All @@ -86,7 +75,6 @@ extension SyntaxProtocol {
case .functionParameter:
let param = FunctionParameterSyntax(self)!
for child in param.children(viewMode: .sourceAccurate) {
let childKind = child.kind
let childIndex = child.indexInParent
// index 7 is the interal name, which we don't render at all
guard childIndex != 7 else { continue }
Expand All @@ -100,16 +88,6 @@ extension SyntaxProtocol {
} else {
SharedLogger.warn("Unhandled tokenKind '\(token.tokenKind)' for function parameter label")
}
} else if childKind == .attributeList {
let attrs = AttributeListSyntax(child)!
let lastAttrs = attrs.count - 1
for attr in attrs {
let attrIndex = attrs.indexInParent
attr.tokenize(apiview: a, parent: parent)
if attrIndex != lastAttrs {
a.whitespace()
}
}
} else {
child.tokenize(apiview: a, parent: parent)
}
Expand Down Expand Up @@ -188,22 +166,6 @@ extension SyntaxProtocol {
tokenize(token: token, apiview: a, parent: (parent as? DeclarationModel))
case .typealiasDecl:
DeclarationModel(from: TypealiasDeclSyntax(self)!, parent: parent).tokenize(apiview: a, parent: parent)
case .accessorBlock:
let obj = AccessorBlockSyntax(self)!
for child in obj.children(viewMode: .sourceAccurate) {
if child.kind == .token {
let token = TokenSyntax(child)!
let tokenKind = token.tokenKind
let tokenText = token.withoutTrivia().description
if tokenKind == .leftBrace || tokenKind == .rightBrace {
a.punctuation(tokenText, spacing: .Both)
} else {
child.tokenize(token: token, apiview: a, parent: nil)
}
} else {
child.tokenize(apiview: a, parent: parent)
}
}
default:
// default behavior for all nodes is to render all children
tokenizeChildren(apiview: a, parent: parent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ extension SwiftSyntax.TokenKind {
case "objc": return .TrimLeft
case "lowerThan", "higherThan", "associativity": return .Neither
case "available", "unavailable", "introduced", "deprecated", "obsoleted", "message", "renamed": return .Neither
case "willSet", "didSet", "get", "set":
return .Leading
default: return .Both
}
default:
Expand Down
104 changes: 2 additions & 102 deletions src/swift/SwiftAPIViewCore/SwiftAPIViewCore.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 73;
objectVersion = 55;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -72,100 +72,6 @@
0AA1BFBF2953955500AE8C11 /* PatternBindingListSyntax+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PatternBindingListSyntax+Extensions.swift"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */
0ACFCCB72CFE32E2006BFBE8 /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = {
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
membershipExceptions = (
AttributesTestFile.swifttxt,
EnumerationsTestFile.swifttxt,
ExtensionTestFile.swifttxt,
FunctionsTestFile.swifttxt,
GenericsTestFile.swifttxt,
InitializersTestFile.swifttxt,
OperatorTestFile.swifttxt,
PrivateInternalTestFile.swifttxt,
PropertiesTestFile.swifttxt,
ProtocolTestFile.swifttxt,
SwiftUITestFile.swifttxt,
);
target = 0A8469E827879AE200C967A8 /* SwiftAPIViewCoreTests */;
};
0ACFCCBA2CFE332E006BFBE8 /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = {
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
membershipExceptions = (
AttributesTestFile.swifttxt,
EnumerationsTestFile.swifttxt,
ExtensionTestFile.swifttxt,
FunctionsTestFile.swifttxt,
GenericsTestFile.swifttxt,
InitializersTestFile.swifttxt,
OperatorTestFile.swifttxt,
PrivateInternalTestFile.swifttxt,
PropertiesTestFile.swifttxt,
ProtocolTestFile.swifttxt,
SwiftUITestFile.swifttxt,
);
target = 0A8469E027879AE200C967A8 /* SwiftAPIViewCore */;
};
0ACFCCBD2CFE3BC0006BFBE8 /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = {
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
membershipExceptions = (
AttributesExpectFile.txt,
EnumerationsExpectFile.txt,
ExtensionExpectFile.txt,
FunctionsExpectFile.txt,
GenericsExpectFile.txt,
InitializersExpectFile.txt,
OperatorExpectFile.txt,
PrivateInternalExpectFile.txt,
PropertiesExpectFile.txt,
ProtocolExpectFile.txt,
SwiftUIExpectFile.txt,
);
target = 0A8469E827879AE200C967A8 /* SwiftAPIViewCoreTests */;
};
0ACFCCBF2CFE3BC3006BFBE8 /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = {
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
membershipExceptions = (
AttributesExpectFile.txt,
EnumerationsExpectFile.txt,
ExtensionExpectFile.txt,
FunctionsExpectFile.txt,
GenericsExpectFile.txt,
InitializersExpectFile.txt,
OperatorExpectFile.txt,
PrivateInternalExpectFile.txt,
PropertiesExpectFile.txt,
ProtocolExpectFile.txt,
SwiftUIExpectFile.txt,
);
target = 0A8469E027879AE200C967A8 /* SwiftAPIViewCore */;
};
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */

/* Begin PBXFileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet section */
0ACFCCC22CFE614B006BFBE8 /* PBXFileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet */ = {
isa = PBXFileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet;
buildPhase = 0A8469DD27879AE200C967A8 /* Sources */;
membershipExceptions = (
EnumerationsTestFile.swifttxt,
FunctionsTestFile.swifttxt,
GenericsTestFile.swifttxt,
InitializersTestFile.swifttxt,
OperatorTestFile.swifttxt,
PrivateInternalTestFile.swifttxt,
PropertiesTestFile.swifttxt,
ProtocolTestFile.swifttxt,
SwiftUITestFile.swifttxt,
);
};
/* End PBXFileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet section */

/* Begin PBXFileSystemSynchronizedRootGroup section */
0ACFCCB22CFE3288006BFBE8 /* TestFiles */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (0ACFCCBA2CFE332E006BFBE8 /* PBXFileSystemSynchronizedBuildFileExceptionSet */, 0ACFCCC22CFE614B006BFBE8 /* PBXFileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet */, 0ACFCCB72CFE32E2006BFBE8 /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = TestFiles; sourceTree = "<group>"; };
0ACFCCB32CFE32B9006BFBE8 /* ExpectFiles */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (0ACFCCBF2CFE3BC3006BFBE8 /* PBXFileSystemSynchronizedBuildFileExceptionSet */, 0ACFCCBD2CFE3BC0006BFBE8 /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = ExpectFiles; sourceTree = "<group>"; };
/* End PBXFileSystemSynchronizedRootGroup section */

/* Begin PBXFrameworksBuildPhase section */
0A8469DE27879AE200C967A8 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
Expand Down Expand Up @@ -240,8 +146,6 @@
0A846A0227879D0400C967A8 /* Tests */ = {
isa = PBXGroup;
children = (
0ACFCCB32CFE32B9006BFBE8 /* ExpectFiles */,
0ACFCCB22CFE3288006BFBE8 /* TestFiles */,
0A846A0327879D0400C967A8 /* SwiftAPIViewCoreTests.swift */,
);
path = Tests;
Expand Down Expand Up @@ -335,10 +239,6 @@
dependencies = (
0A8469EC27879AE200C967A8 /* PBXTargetDependency */,
);
fileSystemSynchronizedGroups = (
0ACFCCB22CFE3288006BFBE8 /* TestFiles */,
0ACFCCB32CFE32B9006BFBE8 /* ExpectFiles */,
);
name = SwiftAPIViewCoreTests;
productName = SwiftAPIViewCoreTests;
productReference = 0A8469E927879AE200C967A8 /* SwiftAPIViewCoreTests.xctest */;
Expand All @@ -363,6 +263,7 @@
};
};
buildConfigurationList = 0A8469DB27879AE200C967A8 /* Build configuration list for PBXProject "SwiftAPIViewCore" */;
compatibilityVersion = "Xcode 13.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
Expand All @@ -375,7 +276,6 @@
0A1CA129292D8B5800CC2367 /* XCRemoteSwiftPackageReference "swift-syntax" */,
0A6C6596292E98890075C56F /* XCRemoteSwiftPackageReference "SourceKitten" */,
);
preferredProjectObjectVersion = 55;
productRefGroup = 0A8469E227879AE200C967A8 /* Products */;
projectDirPath = "";
projectRoot = "";
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit b21f8f3

Please sign in to comment.