Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,24 @@ concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
# TODO: Re-enable when --ifdef no-indent works as intended
# lint:
# name: Lint
# runs-on: macos-latest
# steps:
# - name: Git Checkout
# uses: actions/checkout@v5
lint:
name: Lint
runs-on: macos-latest
steps:
- name: Git Checkout
uses: actions/checkout@v5
with:
persist-credentials: false

# - name: Install SwiftFormat
# run: |
# brew unlink swiftformat
# brew install swiftformat --HEAD
- name: Install Mise tools
uses: jdx/mise-action@v3

# - name: SwiftFormat Lint
# run: swiftformat --lint . --reporter github-actions-log
- name: SwiftFormat Lint
run: mise exec -- swiftformat --lint . --reporter github-actions-log

apple:
if: github.event_name != 'pull_request' || !contains(github.event.pull_request.title, '[skip ci]')
Expand Down
1 change: 1 addition & 0 deletions .swiftformat
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@
--disable redundantViewBuilder
--disable unusedArguments
--disable wrapFunctionBodies
--disable wrapIfStatementBodies
--disable wrapPropertyBodies
36 changes: 18 additions & 18 deletions Tests/AssociationTests/AssociatedMacroTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
// SOFTWARE.

#if canImport(AssociationMacro)
@testable import AssociationMacro
import MacroTesting
import SnapshotTesting
import SwiftSyntax
import Testing
@testable import AssociationMacro

@Suite(
.macros(
Expand Down Expand Up @@ -220,7 +220,7 @@ struct AssociatedTests {
}

@Test
func stringWithOtherPolicy() {
func `string with other policy`() {
assertMacro {
"""
@Associated(.retain(.nonatomic))
Expand Down Expand Up @@ -266,7 +266,7 @@ struct AssociatedTests {
}

@Test
func optionalString() {
func `optional string`() {
assertMacro {
"""
@Associated(.retain(.nonatomic))
Expand Down Expand Up @@ -302,7 +302,7 @@ struct AssociatedTests {
}

@Test
func optionalGenericsString() {
func `optional String using generic syntax`() {
assertMacro {
"""
@Associated(.retain(.nonatomic))
Expand Down Expand Up @@ -338,7 +338,7 @@ struct AssociatedTests {
}

@Test
func implicitlyUnwrappedOptionalString() {
func `implicitly unwrapped optional string`() {
assertMacro {
"""
@Associated(.retain(.nonatomic))
Expand Down Expand Up @@ -374,7 +374,7 @@ struct AssociatedTests {
}

@Test
func optionalStringWithInitialValue() {
func `optional string with initial value`() {
assertMacro {
"""
@Associated(.retain(.nonatomic))
Expand Down Expand Up @@ -476,7 +476,7 @@ struct AssociatedTests {
}

@Test
func intArray() {
func `Int array`() {
assertMacro {
"""
@Associated(.retain(.nonatomic))
Expand Down Expand Up @@ -522,7 +522,7 @@ struct AssociatedTests {
}

@Test
func optionalBool() {
func `optional Bool`() {
assertMacro {
"""
@Associated(.retain(.nonatomic))
Expand Down Expand Up @@ -604,7 +604,7 @@ struct AssociatedTests {
}

@Test
func willSet() {
func `willSet`() {
assertMacro {
"""
@Associated(.retain(.nonatomic))
Expand Down Expand Up @@ -666,7 +666,7 @@ struct AssociatedTests {
}

@Test
func didSet() {
func `didSet`() {
assertMacro {
"""
@Associated(.retain(.nonatomic))
Expand Down Expand Up @@ -726,7 +726,7 @@ struct AssociatedTests {
}

@Test
func willSetAndDidSet() {
func `willSet and didSet`() {
assertMacro {
"""
@Associated(.retain(.nonatomic))
Expand Down Expand Up @@ -800,7 +800,7 @@ struct AssociatedTests {
}

@Test
func willSetWithArgument() {
func `willSet with argument`() {
assertMacro {
"""
@Associated(.retain(.nonatomic))
Expand Down Expand Up @@ -862,7 +862,7 @@ struct AssociatedTests {
}

@Test
func didSetWithArgument() {
func `didSet with argument`() {
assertMacro {
"""
@Associated(.retain(.nonatomic))
Expand Down Expand Up @@ -922,7 +922,7 @@ struct AssociatedTests {
}

@Test
func modernWritingStyle() {
func `modern writing style`() {
assertMacro {
"""
@Associated(.copy(.nonatomic))
Expand Down Expand Up @@ -970,7 +970,7 @@ struct AssociatedTests {
// MARK: Diagnostics test

@Test
func diagnosticsDeclarationType() {
func `requires a property declaration`() {
assertMacro {
"""
@Associated(.retain(.nonatomic))
Expand All @@ -986,7 +986,7 @@ struct AssociatedTests {
}

@Test
func diagnosticsGetterAndSetter() {
func `rejects implemented getter and setter`() {
assertMacro {
"""
@Associated(.retain(.nonatomic))
Expand All @@ -1009,7 +1009,7 @@ struct AssociatedTests {
}

@Test
func diagnosticsInitialValue() {
func `requires an initial value`() {
assertMacro {
"""
@Associated(.retain(.nonatomic))
Expand All @@ -1025,7 +1025,7 @@ struct AssociatedTests {
}

@Test
func diagnosticsSpecifyType() {
func `requires an explicit type`() {
assertMacro {
"""
@Associated(.retain(.nonatomic))
Expand Down
6 changes: 3 additions & 3 deletions Tests/AssociationTests/ClassTypeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ClassType {
@Suite
struct Tests {
@Test
func keysUnique() {
func `keys are unique`() {
let keys = [
ClassType.__associated_intKey,
ClassType.__associated_optionalDoubleKey,
Expand Down Expand Up @@ -117,13 +117,13 @@ class ClassType {
}

@Test
func setDefaultValue() {
func `default value is stable`() {
let item = ClassType()
#expect(item.classType === item.classType)
}

@Test
func testProtocol() {
func `associated property declared in protocol`() {
let item = ClassType()
#expect(item.definedInProtocol == "hello")

Expand Down
16 changes: 8 additions & 8 deletions Tests/AssociationTests/PatternBindingSyntax+Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
// SOFTWARE.

#if canImport(AssociationMacro)
@testable import AssociationMacro
import SwiftSyntax
import SwiftSyntaxBuilder
import Testing
@testable import AssociationMacro

@Suite
struct PatternBindingSyntaxTests {
@Test
func testSetter() {
func `reads setter`() {
let setter = AccessorDeclSyntax(accessorSpecifier: .keyword(.set), body: .init(statements: CodeBlockItemListSyntax {}))

let binding: PatternBindingSyntax = .init(
Expand All @@ -45,7 +45,7 @@ struct PatternBindingSyntaxTests {
}

@Test
func testGetter() throws {
func `reads getter`() throws {
let getter = AccessorDeclSyntax(accessorSpecifier: .keyword(.get), body: .init(statements: CodeBlockItemListSyntax {}))

var binding: PatternBindingSyntax = .init(
Expand Down Expand Up @@ -73,7 +73,7 @@ struct PatternBindingSyntaxTests {
}

@Test
func setSetter() {
func `sets setter`() {
let setter = AccessorDeclSyntax(accessorSpecifier: .keyword(.set), body: .init(statements: CodeBlockItemListSyntax {}))
var binding: PatternBindingSyntax = .init(
pattern: IdentifierPatternSyntax(identifier: .identifier("value")),
Expand Down Expand Up @@ -108,7 +108,7 @@ struct PatternBindingSyntaxTests {
}

@Test
func setGetter() {
func `sets getter`() {
let getter = AccessorDeclSyntax(accessorSpecifier: .keyword(.get), body: .init(statements: CodeBlockItemListSyntax {}))
var binding: PatternBindingSyntax = .init(
pattern: IdentifierPatternSyntax(identifier: .identifier("value")),
Expand Down Expand Up @@ -157,7 +157,7 @@ struct PatternBindingSyntaxTests {
}

@Test
func testWillSet() {
func `willSet`() {
let `willSet` = AccessorDeclSyntax(accessorSpecifier: .keyword(.willSet), body: .init(statements: CodeBlockItemListSyntax {}))

let binding: PatternBindingSyntax = .init(
Expand All @@ -173,7 +173,7 @@ struct PatternBindingSyntaxTests {
}

@Test
func testDidSet() {
func `didSet`() {
let `didSet` = AccessorDeclSyntax(accessorSpecifier: .keyword(.didSet), body: .init(statements: CodeBlockItemListSyntax {}))

let binding: PatternBindingSyntax = .init(
Expand All @@ -189,7 +189,7 @@ struct PatternBindingSyntaxTests {
}

@Test
func setWillSet() {
func `sets willSet`() {
let `willSet` = AccessorDeclSyntax(accessorSpecifier: .keyword(.willSet), body: .init(statements: CodeBlockItemListSyntax {}))

var binding: PatternBindingSyntax = .init(
Expand Down
14 changes: 7 additions & 7 deletions Tests/SwizzlingTests/SwizzleMacroTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import MacroTesting
import SnapshotTesting
import SwiftSyntax
import Testing
@testable import SwizzlingMacro
import Testing

@Suite(
.macros(
Expand All @@ -19,7 +19,7 @@ struct SwizzleMacroTests {}
/// Test property swizzling
extension SwizzleMacroTests {
@Test(arguments: ["self", "$self", "`self`"])
func swizzleGetter(selfLabel: String) {
func `swizzle getter`(selfLabel: String) {
assertMacro {
"""
#swizzle(
Expand Down Expand Up @@ -52,7 +52,7 @@ extension SwizzleMacroTests {
}

@Test(arguments: ["self", "$self", "`self`"])
func swizzleSetter(selfLabel: String) {
func `swizzle setter`(selfLabel: String) {
assertMacro {
"""
#swizzle(
Expand Down Expand Up @@ -86,7 +86,7 @@ extension SwizzleMacroTests {
/// Test function swizzling
extension SwizzleMacroTests {
@Test(arguments: ["self", "$self", "`self`"])
func swizzleFunctionWithoutParametersWithoutReturn(selfLabel: String) {
func `swizzle function without parameters or a return value`(selfLabel: String) {
assertMacro {
"""
#swizzle(
Expand Down Expand Up @@ -116,7 +116,7 @@ extension SwizzleMacroTests {
}

@Test(arguments: ["self", "$self", "`self`"])
func swizzleFunctionWithoutParametersWithReturn(selfLabel: String) {
func `swizzle function without parameters and with a return value`(selfLabel: String) {
assertMacro {
"""
#swizzle(
Expand Down Expand Up @@ -149,7 +149,7 @@ extension SwizzleMacroTests {
}

@Test(arguments: ["param", "params"], ["self", "$self", "`self`"])
func swizzleFunctionWithParametersWithoutReturn(paramOrParams: String, selfLabel: String) {
func `swizzle function with parameters and without a return value`(paramOrParams: String, selfLabel: String) {
assertMacro {
"""
#swizzle(
Expand Down Expand Up @@ -180,7 +180,7 @@ extension SwizzleMacroTests {
}

@Test(arguments: ["self", "$self", "`self`"])
func swizzleFunctionWithParametersWithReturn(selfLabel: String) {
func `swizzle function with parameters and a return value`(selfLabel: String) {
assertMacro {
"""
#swizzle(
Expand Down
Loading
Loading