Use XCTAssert instead of XCTAssertTrue

This commit is contained in:
Danny Moesch 2018-12-15 21:51:22 +01:00 committed by Bob Sun
parent ae57042f36
commit c18b70e7d7
4 changed files with 18 additions and 18 deletions

View file

@ -35,7 +35,7 @@ class PasswordTest: XCTestCase {
XCTAssertEqual(password.password, "")
XCTAssertEqual(password.plainData, fileContent.data(using: .utf8))
XCTAssertEqual(password.additionsPlainText, "")
XCTAssertTrue(password.getFilteredAdditions().isEmpty)
XCTAssert(password.getFilteredAdditions().isEmpty)
XCTAssertEqual(password.numberOfUnknowns, 0)
XCTAssertNil(password.username)
@ -224,7 +224,7 @@ class PasswordTest: XCTestCase {
XCTAssertEqual(password.password, fileContent)
XCTAssertEqual(password.plainData, fileContent.data(using: .utf8))
XCTAssertTrue(password.additionsPlainText.isEmpty)
XCTAssert(password.additionsPlainText.isEmpty)
XCTAssertEqual(password.numberOfUnknowns, 0)
XCTAssertEqual(password.numberOfOtpRelated, 0)
@ -306,7 +306,7 @@ class PasswordTest: XCTestCase {
let otpStrings = password.getOtpStrings()
XCTAssertNotNil(otpStrings)
XCTAssertTrue(otpStrings!.description.hasPrefix("time-based (expires in"))
XCTAssert(otpStrings!.description.hasPrefix("time-based (expires in"))
}
func testOtpStringsHotpToken() {

View file

@ -21,9 +21,9 @@ class AdditionFieldTest: XCTestCase {
XCTAssertEqual(field2.asString, "no content: ")
XCTAssertEqual(field3.asString, "no title")
XCTAssertTrue(field1.asTuple == ("key", "value"))
XCTAssertTrue(field2.asTuple == ("no content", ""))
XCTAssertTrue(field3.asTuple == ("", "no title"))
XCTAssert(field1.asTuple == ("key", "value"))
XCTAssert(field2.asTuple == ("no content", ""))
XCTAssert(field3.asTuple == ("", "no title"))
}
func testAdditionFieldEquals() {

View file

@ -13,22 +13,22 @@ import XCTest
class ConstantsTest: XCTestCase {
func testIsOtpRelated() {
XCTAssertTrue(Constants.isOtpRelated(line: "otpauth://something"))
XCTAssertTrue(Constants.isOtpRelated(line: "otp_algorithm: algorithm"))
XCTAssert(Constants.isOtpRelated(line: "otpauth://something"))
XCTAssert(Constants.isOtpRelated(line: "otp_algorithm: algorithm"))
XCTAssertFalse(Constants.isOtpRelated(line: "otp: something"))
XCTAssertFalse(Constants.isOtpRelated(line: "otp"))
}
func testIsOtpKeyword() {
XCTAssertTrue(Constants.isOtpKeyword("otpauth"))
XCTAssertTrue(Constants.isOtpKeyword("oTP_DigITS"))
XCTAssert(Constants.isOtpKeyword("otpauth"))
XCTAssert(Constants.isOtpKeyword("oTP_DigITS"))
XCTAssertFalse(Constants.isOtpKeyword("otp"))
XCTAssertFalse(Constants.isOtpKeyword("no keyword"))
}
func testIsUnknown() {
XCTAssertTrue(Constants.isUnknown("unknown"))
XCTAssertTrue(Constants.isUnknown("unknown string"))
XCTAssert(Constants.isUnknown("unknown"))
XCTAssert(Constants.isUnknown("unknown string"))
XCTAssertFalse(Constants.isUnknown("otp"))
XCTAssertFalse(Constants.isUnknown("Unknown"))
}

View file

@ -28,12 +28,12 @@ class ParserTest: XCTestCase {
}
func testGetKeyValuePair() {
XCTAssertTrue(Parser.getKeyValuePair(from: "key: value") == ("key", "value"))
XCTAssertTrue(Parser.getKeyValuePair(from: "a key: a value") == ("a key", "a value"))
XCTAssertTrue(Parser.getKeyValuePair(from: "key:value") == (nil, "key:value"))
XCTAssertTrue(Parser.getKeyValuePair(from: ": value") == (nil, "value"))
XCTAssertTrue(Parser.getKeyValuePair(from: "key: ") == ("key", ""))
XCTAssertTrue(Parser.getKeyValuePair(from: "otpauth://value") == ("otpauth", "otpauth://value"))
XCTAssert(Parser.getKeyValuePair(from: "key: value") == ("key", "value"))
XCTAssert(Parser.getKeyValuePair(from: "a key: a value") == ("a key", "a value"))
XCTAssert(Parser.getKeyValuePair(from: "key:value") == (nil, "key:value"))
XCTAssert(Parser.getKeyValuePair(from: ": value") == (nil, "value"))
XCTAssert(Parser.getKeyValuePair(from: "key: ") == ("key", ""))
XCTAssert(Parser.getKeyValuePair(from: "otpauth://value") == ("otpauth", "otpauth://value"))
}
func testEmptyFiles() {