I am new to Xcode XCTest and i want to test my Extension from another file
StringExtensions.swift
import Foundation
extension String : IntegerLiteralConvertible{
public init(integerLiteral value: Int) {
self = "\(value)"
}
}
StringExtensionsTest.swift
import XCTest
class StringExtensionsTest: XCTestCase {
override func setUp() {
super.setUp()
}
override func tearDown() {
super.tearDown()
}
func testIntegerInitializer() {
let string:String = 12345
assert(string == "12345")
}
}
And i get "Cannot convert value of type 'Int' to specified type 'String'" but when i put this extension into Test file it works like a charm.
How can I test extensions from another file?
Aucun commentaire:
Enregistrer un commentaire