Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set Swift settings for tests target #313

Merged
merged 3 commits into from
Jan 30, 2024
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
1 change: 1 addition & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ let package = Package(
"__Snapshots__",
"UIKit/__Snapshots__",
],
swiftSettings: .swiftSettings,
plugins: [
.plugin(name: SwiftLint.plugin),
]),
Expand Down
1 change: 1 addition & 0 deletions Tests/LayoutTests/Builders/ConstraintsBuilderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Layout
import Nimble
import XCTest

@MainActor
final class ConstraintsBuilderTests: XCTestCase {

func testConstraintsBuilder() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import Nimble
import XCTest

@MainActor
final class ViewLayoutItemTests: XCTestCase {

func testInitLayoutItemViewSuperviewConstraints() {
Expand Down
7 changes: 6 additions & 1 deletion Tests/LayoutTests/Support/NimbleMatchers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import XCTest

extension XCTestCase {

@MainActor
internal func haveUnambiguousLayout() -> Matcher<UIView> {
Matcher { expression in
guard let view: UIView = try expression.evaluate()
Expand All @@ -24,7 +25,9 @@ extension XCTestCase {
}
}

// swiftlint:disable:next cyclomatic_complexity
// swiftlint:disable cyclomatic_complexity

@MainActor
internal func match(_ expectedConstraint: NSLayoutConstraint) -> Matcher<NSLayoutConstraint> {
// swiftlint:disable:next closure_body_length
Matcher { expression in
Expand Down Expand Up @@ -138,6 +141,8 @@ extension XCTestCase {
return MatcherResult(bool: true, message: .fail(""))
}
}

// swiftlint:enable cyclomatic_complexity
}

extension Optional {
Expand Down
16 changes: 16 additions & 0 deletions Tests/LayoutTests/Support/View.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,66 +35,82 @@ internal final class View: UIView {
}
}

@MainActor
internal var pinkView: UIView {
View(named: "Pink", with: UIColor(red: 1, green: 0.176471, blue: 0.333333, alpha: 1))
}

@MainActor
internal var blackView: UIView {
View(named: "Black", with: .black)
}

@MainActor
internal var darkGrayView: UIView {
View(named: "DarkGray", with: .darkGray)
}

@MainActor
internal var lightGrayView: UIView {
View(named: "LightGray", with: .lightGray)
}

@MainActor
internal var whiteView: UIView {
View(named: "White", with: .white)
}

@MainActor
internal var grayView: UIView {
View(named: "Gray", with: .gray)
}

@MainActor
internal var redView: UIView {
View(named: "Red", with: .red)
}

@MainActor
internal var greenView: UIView {
View(named: "Green", with: .green)
}

@MainActor
internal var blueView: UIView {
View(named: "Blue", with: .blue)
}

@MainActor
internal var cyanView: UIView {
View(named: "Cyan", with: .cyan)
}

@MainActor
internal var yellowView: UIView {
View(named: "Yellow", with: .yellow)
}

@MainActor
internal var magentaView: UIView {
View(named: "Magenta", with: .magenta)
}

@MainActor
internal var orangeView: UIView {
View(named: "Orange", with: .orange)
}

@MainActor
internal var purpleView: UIView {
View(named: "Purple", with: .purple)
}

@MainActor
internal var brownView: UIView {
View(named: "Brown", with: .brown)
}

@MainActor
internal var clearView: UIView {
View(named: "Clear", with: .clear)
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import Nimble
import XCTest

@MainActor
final class NSLayoutConstraintAttributeTests: XCTestCase {

func testCanonicalAttribute() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import Nimble
import XCTest

@MainActor
final class NSLayoutConstraintAxisTests: XCTestCase {

func testAttribute() {
Expand Down
1 change: 1 addition & 0 deletions Tests/LayoutTests/UIKit/UIView+AutoLayoutTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Nimble
import UIKit
import XCTest

@MainActor
final class UIViewAutoLayoutTests: XCTestCase {

// MARK: - Builder
Expand Down
1 change: 1 addition & 0 deletions Tests/LayoutTests/UIKit/UIView+FramesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import Layout
import Nimble
import XCTest

@MainActor
final class UIViewFramesTests: XCTestCase {

func testUsingFramesWithAutoresizingMask() {
Expand Down
1 change: 1 addition & 0 deletions Tests/LayoutTests/UIKit/UIView+NSLayoutAnchorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Nimble
import UIKit
import XCTest

@MainActor
final class UIViewNSLayoutAnchorTests: XCTestCase {

func testAnchorForAxisAttributeXAxis() {
Expand Down
Loading