admin管理员组文章数量:1125782
I have several tests written for a series of static properties within an extension in Swift, but I can't get SonarQube to mark them as covered.
I've tried everything, but even with the following code, it still says they are not covered. Any ideas?
import XCTest
import SwiftUI
@testable import Core
class FontTests: XCTestCase {
func testFontProperties() {
XCTAssertNotNil(Font.flamaBook)
XCTAssertNotNil(Font.flamaBasic)
XCTAssertNotNil(Font.flamaMedium)
}
func testCustomFontDefinitions() {
XCTAssertEqual(Font.flamaBook, "Flama-Book")
XCTAssertEqual(Font.flamaBasic, "Flama-Basic")
XCTAssertEqual(Font.flamaMedium, "Flama-Medium")
}
func testFontStyles() {
XCTAssertEqual(Font.h1, Font.custom(Font.flamaBook, size: 24))
XCTAssertEqual(Font.h2, Font.custom(Font.flamaBook, size: 18))
XCTAssertEqual(Font.h3, Font.custom(Font.flamaBook, size: 16))
XCTAssertEqual(Font.h4, Font.custom(Font.flamaMedium, size: 14))
XCTAssertEqual(Font.p1, Font.custom(Font.flamaBook, size: 15))
XCTAssertEqual(Font.p2, Font.custom(Font.flamaMedium, size: 12))
XCTAssertEqual(Font.p3, Font.custom(Font.flamaBasic, size: 12))
XCTAssertEqual(Font.link, Font.custom(Font.flamaBook, size: 16))
XCTAssertEqual(Font.formElement, Font.custom(Font.flamaBook, size: 15))
XCTAssertEqual(Font.formElementBasic, Font.custom(Font.flamaBasic, size: 15))
XCTAssertEqual(Font.button, Font.custom(Font.flamaBook, size: 16))
XCTAssertEqual(Font.otp, Font.custom(Font.flamaBasic, size: 30))
XCTAssertEqual(Font.balance1, Font.custom(Font.flamaBasic, size: 22))
XCTAssertEqual(Font.balance2, Font.custom(Font.flamaBasic, size: 36))
XCTAssertEqual(Font.tabBar, Font.custom(Font.flamaMedium, size: 11))
}
}
本文标签: testingSwift static properties are not marked as covered by tests in SonarQubeStack Overflow
版权声明:本文标题:testing - Swift static properties are not marked as covered by tests in SonarQube - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736665538a1946640.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论