Add visibility parameters to control scope of generated extension
Some checks failed
gitea-openium/resgen.swift/pipeline/head There was a failure building this commit
Some checks failed
gitea-openium/resgen.swift/pipeline/head There was a failure building this commit
This commit is contained in:
@ -21,11 +21,15 @@ final class FontNameTests: XCTestCase {
|
||||
)
|
||||
|
||||
// When
|
||||
let property = fontName.getProperty(isStatic: true, isSwiftUI: false)
|
||||
let property = fontName.getProperty(
|
||||
isStatic: true,
|
||||
isSwiftUI: false,
|
||||
visibility: .internal
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
static let CircularStdBold: ((_ size: CGFloat) -> UIFont) = { size in
|
||||
internal static let CircularStdBold: ((_ size: CGFloat) -> UIFont) = { size in
|
||||
UIFont(name: FontName.CircularStdBold.rawValue, size: size)!
|
||||
}
|
||||
"""
|
||||
@ -42,11 +46,15 @@ final class FontNameTests: XCTestCase {
|
||||
)
|
||||
|
||||
// When
|
||||
let property = fontName.getProperty(isStatic: true, isSwiftUI: false)
|
||||
let property = fontName.getProperty(
|
||||
isStatic: true,
|
||||
isSwiftUI: false,
|
||||
visibility: .package
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
static let CircularStdBoldUnderline: ((_ size: CGFloat) -> UIFont) = { size in
|
||||
package static let CircularStdBoldUnderline: ((_ size: CGFloat) -> UIFont) = { size in
|
||||
UIFont(name: FontName.CircularStdBoldUnderline.rawValue, size: size)!
|
||||
}
|
||||
"""
|
||||
@ -63,11 +71,15 @@ final class FontNameTests: XCTestCase {
|
||||
)
|
||||
|
||||
// When
|
||||
let property = fontName.getProperty(isStatic: false, isSwiftUI: false)
|
||||
let property = fontName.getProperty(
|
||||
isStatic: false,
|
||||
isSwiftUI: false,
|
||||
visibility: .private
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
func CircularStdBold(withSize size: CGFloat) -> UIFont {
|
||||
private func CircularStdBold(withSize size: CGFloat) -> UIFont {
|
||||
UIFont(name: FontName.CircularStdBold.rawValue, size: size)!
|
||||
}
|
||||
"""
|
||||
@ -84,11 +96,15 @@ final class FontNameTests: XCTestCase {
|
||||
)
|
||||
|
||||
// When
|
||||
let property = fontName.getProperty(isStatic: false, isSwiftUI: false)
|
||||
let property = fontName.getProperty(
|
||||
isStatic: false,
|
||||
isSwiftUI: false,
|
||||
visibility: .public
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
func CircularStdBoldUnderline(withSize size: CGFloat) -> UIFont {
|
||||
public func CircularStdBoldUnderline(withSize size: CGFloat) -> UIFont {
|
||||
UIFont(name: FontName.CircularStdBoldUnderline.rawValue, size: size)!
|
||||
}
|
||||
"""
|
||||
@ -105,11 +121,15 @@ final class FontNameTests: XCTestCase {
|
||||
)
|
||||
|
||||
// When
|
||||
let property = fontName.getProperty(isStatic: true, isSwiftUI: true)
|
||||
let property = fontName.getProperty(
|
||||
isStatic: true,
|
||||
isSwiftUI: true,
|
||||
visibility: .public
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
static let CircularStdBold: ((_ size: CGFloat) -> Font) = { size in
|
||||
public static let CircularStdBold: ((_ size: CGFloat) -> Font) = { size in
|
||||
Font.custom(FontName.CircularStdBold.rawValue, size: size)
|
||||
}
|
||||
"""
|
||||
@ -126,11 +146,15 @@ final class FontNameTests: XCTestCase {
|
||||
)
|
||||
|
||||
// When
|
||||
let property = fontName.getProperty(isStatic: true, isSwiftUI: true)
|
||||
let property = fontName.getProperty(
|
||||
isStatic: true,
|
||||
isSwiftUI: true,
|
||||
visibility: .package
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
static let CircularStdBoldUnderline: ((_ size: CGFloat) -> Font) = { size in
|
||||
package static let CircularStdBoldUnderline: ((_ size: CGFloat) -> Font) = { size in
|
||||
Font.custom(FontName.CircularStdBoldUnderline.rawValue, size: size)
|
||||
}
|
||||
"""
|
||||
@ -147,11 +171,15 @@ final class FontNameTests: XCTestCase {
|
||||
)
|
||||
|
||||
// When
|
||||
let property = fontName.getProperty(isStatic: false, isSwiftUI: true)
|
||||
let property = fontName.getProperty(
|
||||
isStatic: false,
|
||||
isSwiftUI: true,
|
||||
visibility: .package
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
func CircularStdBold(withSize size: CGFloat) -> Font {
|
||||
package func CircularStdBold(withSize size: CGFloat) -> Font {
|
||||
Font.custom(FontName.CircularStdBold.rawValue, size: size)
|
||||
}
|
||||
"""
|
||||
@ -168,11 +196,15 @@ final class FontNameTests: XCTestCase {
|
||||
)
|
||||
|
||||
// When
|
||||
let property = fontName.getProperty(isStatic: false, isSwiftUI: true)
|
||||
let property = fontName.getProperty(
|
||||
isStatic: false,
|
||||
isSwiftUI: true,
|
||||
visibility: .internal
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
func CircularStdBoldUnderline(withSize size: CGFloat) -> Font {
|
||||
internal func CircularStdBoldUnderline(withSize size: CGFloat) -> Font {
|
||||
Font.custom(FontName.CircularStdBoldUnderline.rawValue, size: size)
|
||||
}
|
||||
"""
|
||||
|
Reference in New Issue
Block a user