Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
antranapp committed Dec 8, 2020
1 parent 8a83872 commit 42347eb
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: macOS-latest
strategy:
matrix:
destination: ['platform=iOS Simulator,OS=14.0,name=iPhone 11 Pro Max']
destination: ['platform=iOS Simulator,OS=latest,name=iPhone 12 Pro']
steps:
- name: Checkout
uses: actions/checkout@master
Expand Down
3 changes: 1 addition & 2 deletions LeakDetectorDemo/Leak/Delegate/DelegateViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ extension DelegateViewController1: LeakDelegate {
}
}


// MARK: - No Leak Case 1

class NoLeakDelegateViewController1: ChildViewController {
Expand Down Expand Up @@ -62,7 +61,7 @@ class NoLeakDelegateViewController2: ChildViewController, UITableViewDelegate, U
override func viewDidLoad() {
super.viewDidLoad()

self.view.addSubview(tableView)
view.addSubview(tableView)

tableView.delegate = self
tableView.dataSource = self
Expand Down
5 changes: 1 addition & 4 deletions LeakDetectorDemo/Leak/LazyVar/LazyVarViewController.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
//
// LazyVarViewController.swift
// LeakDetectorDemo
//
// Created by An Tran on 28/11/20.
// Copyright © 2020 An Tran. All rights reserved.
//

import Foundation
Expand Down
4 changes: 2 additions & 2 deletions LeakDetectorDemo/Leak/RxSwift/RxViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class RxSwiftViewController2: ChildViewController {

private let disposeBag = DisposeBag()
private lazy var button = {
UIButton()
UIButton()
}()

override func viewDidLoad() {
Expand Down Expand Up @@ -74,7 +74,7 @@ class NoLeakRxSwiftViewController2: ChildViewController {

private let disposeBag = DisposeBag()
private lazy var button = {
UIButton()
UIButton()
}()

override func viewDidLoad() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
//
// SimpleCasesViewController.swift
// LeakDetectorDemo
//
// Created by An Tran on 29/11/20.
// Copyright © 2020 An Tran. All rights reserved.
//

import Foundation
import UIKit

// MARK: - Leak: Case 1:

// https://docs.swift.org/swift-book/LanguageGuide/AutomaticReferenceCounting.html#//apple_ref/doc/uid/TP40014097-CH20-ID48

class Person {
Expand Down Expand Up @@ -116,4 +114,3 @@ class NoLeakSimpleCasesViewController1: LeakDetectableViewController {
}

}

1 change: 1 addition & 0 deletions LeakDetectorDemo/Utils/ChildViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class ChildViewController: UIViewController {
super.init(nibName: nil, bundle: nil)
}

@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
Expand Down
24 changes: 15 additions & 9 deletions LeakDetectorDemoUITests/LeakTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,33 @@ class LeakTests: XCTestCase {
func testLeakByDelegate() throws {
assert(
testCase: "Leak by delegate",
subcase: "Leak - 1",
exitAction: {
self.app.navigationBars["Delegate"].buttons["Leak Detector Demo"].tap()
}
app.buttons["Go Back"].tap()
},
timeout: .viewDisappearExpectation + 0.5
)
}

func testLeakByObservables() throws {
assert(
testCase: "Leak by observables",
subcase: "Leak - 1",
exitAction: {
self.app.navigationBars["Observables"].buttons["Leak Detector Demo"].tap()
}
app.buttons["Go Back"].tap()
},
timeout: .viewDisappearExpectation + 0.5
)
}

func testLeakByCombine() throws {
assert(
testCase: "Leak by assign in Combine",
testCase: "Leak by Combine",
subcase: "Leak - Combine assign",
exitAction: {
self.app.navigationBars["Combine Assign"].buttons["Leak Detector Demo"].tap()
}
app.buttons["Go Back"].tap()
},
timeout: .viewDisappearExpectation + 0.5
)
}

Expand All @@ -68,10 +74,10 @@ class LeakTests: XCTestCase {
)
}

func testLeakByNestedClosures() throws {
func testLeakBySimplelosures() throws {
assert(
testCase: "Leak by Closure",
subcase: "Leak by Nested Closures",
subcase: "Leak by Simple Closure",
exitAction: {
app.buttons["Go Back"].tap()
},
Expand Down

0 comments on commit 42347eb

Please sign in to comment.