The gist is: ```diff -foo = foo + 1 +foo += 1 ``` Most of the violations were in generated files, so I changed and re-ran the generator. A few of these violations required implementing some new methods, which I added tests for. See [the docs for this rule][0]. [0]: https://realm.github.io/SwiftLint/shorthand_operator.html
20 lines
454 B
Swift
20 lines
454 B
Swift
//
|
|
// Copyright (c) 2022 Open Whisper Systems. All rights reserved.
|
|
//
|
|
|
|
import XCTest
|
|
|
|
class CGPointExtensionsTest: XCTestCase {
|
|
func testPlusEquals() throws {
|
|
var point = CGPoint(x: 1, y: 2)
|
|
point += CGPoint(x: 3, y: 4)
|
|
XCTAssertEqual(point, CGPoint(x: 4, y: 6))
|
|
}
|
|
|
|
func testTimesEquals() throws {
|
|
var point = CGPoint(x: 1, y: 2)
|
|
point *= 2
|
|
XCTAssertEqual(point, CGPoint(x: 2, y: 4))
|
|
}
|
|
}
|