Migrate tests from XCTest to Swift Testing
openium/resgen.swift/pipeline/head There was a failure building this commit
openium/resgen.swift/pipeline/pr-master There was a failure building this commit

- Convert XCTestCase classes to structs with @Test functions
- Replace XCTAssert* with #expect, and force unwraps/XCTFail with #require
- Resolve test bundle via a class token in the CLI smoke test (Swift Testing
  does not register the .xctest bundle in Bundle.allBundles)
- Rename adaptForXCTest() to adaptForTest()
This commit is contained in:
t.schmitt committed 2026-11-23 15:53:21 +01:00
1 parent fdd23f4378
commit ac5d9cef58
24 files changed
+437 -374

No files matched your search

@@ -6,15 +6,16 @@
// //
import Foundation import Foundation
import XCTest import Testing
@testable import ResgenSwift @testable import ResgenSwift
final class AnalyticsDefinitionTests: XCTestCase { struct AnalyticsDefinitionTests {
// MARK: - Matching tags // MARK: - Matching tags
func testMatchingAnalyticss() { @Test
func matchingAnalyticss() {
// Given // Given
let definition = AnalyticsDefinition(id: "definition_name", name: "", type: .screen) let definition = AnalyticsDefinition(id: "definition_name", name: "", type: .screen)
definition.tags = ["ios","iosonly","notranslation"] definition.tags = ["ios","iosonly","notranslation"]
@@ -26,12 +27,13 @@ final class AnalyticsDefinitionTests: XCTestCase {
// Expect // Expect
XCTAssertTrue(match1) #expect(match1)
XCTAssertTrue(match2) #expect(match2)
XCTAssertTrue(match3) #expect(match3)
} }
func testNotMatchingAnalyticss() { @Test
func notMatchingAnalyticss() {
// Given // Given
let definition = AnalyticsDefinition(id: "definition_name", name: "", type: .screen) let definition = AnalyticsDefinition(id: "definition_name", name: "", type: .screen)
definition.tags = ["ios","iosonly","notranslation"] definition.tags = ["ios","iosonly","notranslation"]
@@ -42,14 +44,15 @@ final class AnalyticsDefinitionTests: XCTestCase {
let match3 = definition.hasOneOrMoreMatchingTags(inputTags: ["azerty"]) let match3 = definition.hasOneOrMoreMatchingTags(inputTags: ["azerty"])
// Expect // Expect
XCTAssertFalse(match1) #expect(match1 == false)
XCTAssertFalse(match2) #expect(match2 == false)
XCTAssertFalse(match3) #expect(match3 == false)
} }
// MARK: - Raw properties // MARK: - Raw properties
func testGeneratedRawPropertyScreen() { @Test
func generatedRawPropertyScreen() {
// Given // Given
let definition = AnalyticsDefinition(id: "definition_name", name: "Ecran un", type: .screen) let definition = AnalyticsDefinition(id: "definition_name", name: "Ecran un", type: .screen)
definition.path = "ecran_un/" definition.path = "ecran_un/"
@@ -68,10 +71,11 @@ final class AnalyticsDefinitionTests: XCTestCase {
} }
""" """
XCTAssertEqual(propertyScreen.adaptForXCTest(), expectScreen.adaptForXCTest()) #expect(propertyScreen.adaptForTest() == expectScreen.adaptForTest())
} }
func testGeneratedRawPropertyEvent() { @Test
func generatedRawPropertyEvent() {
// Given // Given
let definition = AnalyticsDefinition(id: "definition_name", name: "Ecran un", type: .event) let definition = AnalyticsDefinition(id: "definition_name", name: "Ecran un", type: .event)
@@ -90,10 +94,11 @@ final class AnalyticsDefinitionTests: XCTestCase {
} }
""" """
XCTAssertEqual(propertyEvent.adaptForXCTest(), expectEvent.adaptForXCTest()) #expect(propertyEvent.adaptForTest() == expectEvent.adaptForTest())
} }
func testGeneratedRawStaticPropertyScreen() { @Test
func generatedRawStaticPropertyScreen() {
// Given // Given
let definition = AnalyticsDefinition(id: "definition_name", name: "Ecran un", type: .screen) let definition = AnalyticsDefinition(id: "definition_name", name: "Ecran un", type: .screen)
definition.path = "ecran_un/" definition.path = "ecran_un/"
@@ -112,10 +117,11 @@ final class AnalyticsDefinitionTests: XCTestCase {
} }
""" """
XCTAssertEqual(propertyScreen.adaptForXCTest(), expectScreen.adaptForXCTest()) #expect(propertyScreen.adaptForTest() == expectScreen.adaptForTest())
} }
func testGeneratedRawStaticPropertyEvent() { @Test
func generatedRawStaticPropertyEvent() {
// Given // Given
let definition = AnalyticsDefinition(id: "definition_name", name: "Ecran un", type: .event) let definition = AnalyticsDefinition(id: "definition_name", name: "Ecran un", type: .event)
@@ -134,6 +140,6 @@ final class AnalyticsDefinitionTests: XCTestCase {
} }
""" """
XCTAssertEqual(propertyEvent.adaptForXCTest(), expectEvent.adaptForXCTest()) #expect(propertyEvent.adaptForTest() == expectEvent.adaptForTest())
} }
} }
@@ -8,12 +8,12 @@
// CPD-OFF // CPD-OFF
import Foundation import Foundation
import XCTest import Testing
import ToolCore import ToolCore
@testable import ResgenSwift @testable import ResgenSwift
final class AnalyticsGeneratorTests: XCTestCase { struct AnalyticsGeneratorTests {
private func getAnalyticsDefinition( private func getAnalyticsDefinition(
id: String, id: String,
@@ -208,7 +208,8 @@ final class AnalyticsGeneratorTests: XCTestCase {
""" """
} }
func testGeneratedExtensionContentFirebase() { @Test
func generatedExtensionContentFirebase() {
// Given // Given
let sectionOne = AnalyticsCategory(id: "section_one") let sectionOne = AnalyticsCategory(id: "section_one")
sectionOne.definitions = [ sectionOne.definitions = [
@@ -420,10 +421,11 @@ final class AnalyticsGeneratorTests: XCTestCase {
if extensionContent != expect { if extensionContent != expect {
print(prettyFirstDifferenceBetweenStrings(s1: extensionContent, s2: expect)) print(prettyFirstDifferenceBetweenStrings(s1: extensionContent, s2: expect))
} }
XCTAssertEqual(extensionContent.adaptForXCTest(), expect.adaptForXCTest()) #expect(extensionContent.adaptForTest() == expect.adaptForTest())
} }
func testGeneratedExtensionContentMatomo() { @Test
func generatedExtensionContentMatomo() {
// Given // Given
let sectionOne = AnalyticsCategory(id: "section_one") let sectionOne = AnalyticsCategory(id: "section_one")
sectionOne.definitions = [ sectionOne.definitions = [
@@ -637,10 +639,11 @@ final class AnalyticsGeneratorTests: XCTestCase {
if extensionContent != expect { if extensionContent != expect {
print(prettyFirstDifferenceBetweenStrings(s1: extensionContent, s2: expect)) print(prettyFirstDifferenceBetweenStrings(s1: extensionContent, s2: expect))
} }
XCTAssertEqual(extensionContent.adaptForXCTest(), expect.adaptForXCTest()) #expect(extensionContent.adaptForTest() == expect.adaptForTest())
} }
func testGeneratedExtensionContentMatomoAndFirebase() { @Test
func generatedExtensionContentMatomoAndFirebase() {
// Given // Given
let sectionOne = AnalyticsCategory(id: "section_one") let sectionOne = AnalyticsCategory(id: "section_one")
sectionOne.definitions = [ sectionOne.definitions = [
@@ -860,7 +863,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
if extensionContent != expect { if extensionContent != expect {
print(prettyFirstDifferenceBetweenStrings(s1: extensionContent, s2: expect)) print(prettyFirstDifferenceBetweenStrings(s1: extensionContent, s2: expect))
} }
XCTAssertEqual(extensionContent.adaptForXCTest(), expect.adaptForXCTest()) #expect(extensionContent.adaptForTest() == expect.adaptForTest())
} }
} }
@@ -6,15 +6,16 @@
// //
import Foundation import Foundation
import XCTest import Testing
@testable import ResgenSwift @testable import ResgenSwift
final class AnalyticsSectionTests: XCTestCase { struct AnalyticsSectionTests {
// MARK: - Matching tags // MARK: - Matching tags
func testMatchingAnalytics() { @Test
func matchingAnalytics() {
// Given // Given
let section = AnalyticsCategory(id: "section_name") let section = AnalyticsCategory(id: "section_name")
section.definitions = [ section.definitions = [
@@ -37,13 +38,14 @@ final class AnalyticsSectionTests: XCTestCase {
let match4 = section.hasOneOrMoreMatchingTags(tags: ["droidonly"]) let match4 = section.hasOneOrMoreMatchingTags(tags: ["droidonly"])
// Expect // Expect
XCTAssertTrue(match1) #expect(match1)
XCTAssertTrue(match2) #expect(match2)
XCTAssertTrue(match3) #expect(match3)
XCTAssertTrue(match4) #expect(match4)
} }
func testNotMatchingAnalytics() { @Test
func notMatchingAnalytics() {
// Given // Given
let section = AnalyticsCategory(id: "section_name") let section = AnalyticsCategory(id: "section_name")
section.definitions = [ section.definitions = [
@@ -65,8 +67,8 @@ final class AnalyticsSectionTests: XCTestCase {
let match3 = section.hasOneOrMoreMatchingTags(tags: ["azerty"]) let match3 = section.hasOneOrMoreMatchingTags(tags: ["azerty"])
// Expect // Expect
XCTAssertFalse(match1) #expect(match1 == false)
XCTAssertFalse(match2) #expect(match2 == false)
XCTAssertFalse(match3) #expect(match3 == false)
} }
} }
@@ -6,14 +6,15 @@
// //
import Foundation import Foundation
import XCTest import Testing
import ToolCore import ToolCore
@testable import ResgenSwift @testable import ResgenSwift
final class ColorExtensionGeneratorTests: XCTestCase { struct ColorExtensionGeneratorTests {
func test_uiKit_GeneratedExtensionContent() { @Test
func uiKit_GeneratedExtensionContent() {
// Given // Given
let colors = [ let colors = [
ParsedColor(name: "colorOne", light: "#FF00FF", dark: "#00FF00"), ParsedColor(name: "colorOne", light: "#FF00FF", dark: "#00FF00"),
@@ -50,10 +51,11 @@ final class ColorExtensionGeneratorTests: XCTestCase {
} }
""" """
XCTAssertEqual(extensionContent.adaptForXCTest(), expect.adaptForXCTest()) #expect(extensionContent.adaptForTest() == expect.adaptForTest())
} }
func test_uiKit_GeneratedExtensionContentForIsStatic() { @Test
func uiKit_GeneratedExtensionContentForIsStatic() {
// Given // Given
let colors = [ let colors = [
ParsedColor(name: "colorOne", light: "#FF00FF", dark: "#00FF00"), ParsedColor(name: "colorOne", light: "#FF00FF", dark: "#00FF00"),
@@ -90,10 +92,11 @@ final class ColorExtensionGeneratorTests: XCTestCase {
} }
""" """
XCTAssertEqual(extensionContent.adaptForXCTest(), expect.adaptForXCTest()) #expect(extensionContent.adaptForTest() == expect.adaptForTest())
} }
func test_swiftUI_GeneratedExtensionContent() { @Test
func swiftUI_GeneratedExtensionContent() {
// Given // Given
let colors = [ let colors = [
ParsedColor(name: "colorOne", light: "#FF00FF", dark: "#00FF00"), ParsedColor(name: "colorOne", light: "#FF00FF", dark: "#00FF00"),
@@ -130,10 +133,11 @@ final class ColorExtensionGeneratorTests: XCTestCase {
} }
""" """
XCTAssertEqual(extensionContent.adaptForXCTest(), expect.adaptForXCTest()) #expect(extensionContent.adaptForTest() == expect.adaptForTest())
} }
func test_swiftUI_GeneratedExtensionContentForIsStatic() { @Test
func swiftUI_GeneratedExtensionContentForIsStatic() {
// Given // Given
let colors = [ let colors = [
ParsedColor(name: "colorOne", light: "#FF00FF", dark: "#00FF00"), ParsedColor(name: "colorOne", light: "#FF00FF", dark: "#00FF00"),
@@ -170,6 +174,6 @@ final class ColorExtensionGeneratorTests: XCTestCase {
} }
""" """
XCTAssertEqual(extensionContent.adaptForXCTest(), expect.adaptForXCTest()) #expect(extensionContent.adaptForTest() == expect.adaptForTest())
} }
} }
@@ -6,12 +6,13 @@
// //
import Foundation import Foundation
import XCTest import Testing
@testable import ResgenSwift @testable import ResgenSwift
final class ColorFileParserTests: XCTestCase { struct ColorFileParserTests {
func testCorrectFormat_lightStyle() throws { @Test
func correctFormat_lightStyle() throws {
// Given // Given
let inputWithEqualSeparator = """ let inputWithEqualSeparator = """
red1 = #FF0000 red1 = #FF0000
@@ -60,16 +61,17 @@ final class ColorFileParserTests: XCTestCase {
let testValues = colorsValues.first { $0.name == parsedColor.name } let testValues = colorsValues.first { $0.name == parsedColor.name }
if let testValues = testValues { if let testValues = testValues {
foundColors += 1 foundColors += 1
XCTAssertEqual(parsedColor.name, testValues.name) #expect(parsedColor.name == testValues.name)
XCTAssertEqual(parsedColor.light, testValues.light) #expect(parsedColor.light == testValues.light)
XCTAssertEqual(parsedColor.dark, testValues.dark) #expect(parsedColor.dark == testValues.dark)
} }
} }
XCTAssertEqual(foundColors, 12) #expect(foundColors == 12)
} }
func testCorrectFormat_allColorStyle() throws { @Test
func correctFormat_allColorStyle() throws {
// Given // Given
let input = """ let input = """
lightOnly #FF0000 lightOnly #FF0000
@@ -82,17 +84,15 @@ final class ColorFileParserTests: XCTestCase {
colorStyle: .all) colorStyle: .all)
// Expect // Expect
let colorRed1 = parsedColors.first { $0.name == "lightOnly" } let colorRed1 = try #require(parsedColors.first { $0.name == "lightOnly" })
let colorRed2 = parsedColors.first { $0.name == "lightDark" } let colorRed2 = try #require(parsedColors.first { $0.name == "lightDark" })
XCTAssertNotNil(colorRed1) #expect(colorRed1.name == "lightOnly")
XCTAssertEqual(colorRed1?.name, "lightOnly") #expect(colorRed1.light == "#FF0000")
XCTAssertEqual(colorRed1?.light, "#FF0000") #expect(colorRed1.dark == "#FF0000")
XCTAssertEqual(colorRed1?.dark, "#FF0000")
XCTAssertNotNil(colorRed2) #expect(colorRed2.name == "lightDark")
XCTAssertEqual(colorRed2?.name, "lightDark") #expect(colorRed2.light == "#FF0000")
XCTAssertEqual(colorRed2?.light, "#FF0000") #expect(colorRed2.dark == "#0000FF")
XCTAssertEqual(colorRed2?.dark, "#0000FF")
} }
} }
@@ -6,13 +6,14 @@
// //
import Foundation import Foundation
import XCTest import Testing
@testable import ResgenSwift @testable import ResgenSwift
final class ParsedColorTests: XCTestCase { struct ParsedColorTests {
func test_uiKit_GeneratedProperty() { @Test
func uiKit_GeneratedProperty() {
// Given // Given
let color = ParsedColor(name: "red", light: "#FF0000", dark: "#0000FF") let color = ParsedColor(name: "red", light: "#FF0000", dark: "#0000FF")
@@ -32,10 +33,11 @@ final class ParsedColorTests: XCTestCase {
} }
""" """
XCTAssertEqual(property.adaptForXCTest(), expect.adaptForXCTest()) #expect(property.adaptForTest() == expect.adaptForTest())
} }
func test_uiKit_GeneratedStaticProperty() { @Test
func uiKit_GeneratedStaticProperty() {
// Given // Given
let color = ParsedColor(name: "red", light: "#FF0000", dark: "#0000FF") let color = ParsedColor(name: "red", light: "#FF0000", dark: "#0000FF")
@@ -55,10 +57,11 @@ final class ParsedColorTests: XCTestCase {
} }
""" """
XCTAssertEqual(property.adaptForXCTest(), expect.adaptForXCTest()) #expect(property.adaptForTest() == expect.adaptForTest())
} }
func test_swiftUI_GeneratedProperty() { @Test
func swiftUI_GeneratedProperty() {
// Given // Given
let color = ParsedColor(name: "red", light: "#FF0000", dark: "#0000FF") let color = ParsedColor(name: "red", light: "#FF0000", dark: "#0000FF")
@@ -78,10 +81,11 @@ final class ParsedColorTests: XCTestCase {
} }
""" """
XCTAssertEqual(property.adaptForXCTest(), expect.adaptForXCTest()) #expect(property.adaptForTest() == expect.adaptForTest())
} }
func test_swiftUI_GeneratedStaticProperty() { @Test
func swiftUI_GeneratedStaticProperty() {
// Given // Given
let color = ParsedColor(name: "red", light: "#FF0000", dark: "#0000FF") let color = ParsedColor(name: "red", light: "#FF0000", dark: "#0000FF")
@@ -101,46 +105,40 @@ final class ParsedColorTests: XCTestCase {
} }
""" """
XCTAssertEqual(property.adaptForXCTest(), expect.adaptForXCTest()) #expect(property.adaptForTest() == expect.adaptForTest())
} }
func testGeneratedColorAsset() { @Test
func generatedColorAsset() throws {
// Given // Given
let color = ParsedColor(name: "red", light: "#FF0000", dark: "#0000FF") let color = ParsedColor(name: "red", light: "#FF0000", dark: "#0000FF")
// When // When
let contentJson = color.contentsJSON() let contentJson = color.contentsJSON()
guard let data = contentJson.data(using: .utf8), let data = try #require(contentJson.data(using: .utf8), "Cannot convert `contentJSON` string to Data")
let parsedJson = try? JSONSerialization.jsonObject(with: data) as? [String: Any] else { let parsedJson = try #require(try JSONSerialization.jsonObject(with: data) as? [String: Any])
XCTFail("Cannot convert `contentJSON` string to Data")
return let colors = try #require(parsedJson["colors"] as? [Any])
}
let colors = parsedJson["colors"] as! [Any]
for color in colors { for color in colors {
guard let color = color as? [String: Any] else { let color = try #require(color as? [String: Any], "Cannot convert color object to Dictionary")
XCTFail("Cannot convert color object to Dictonnary") let subColor = try #require(color["color"] as? [String: Any])
return let components = try #require(subColor["components"] as? [String: Any])
}
if let appearance = color["appearances"] as? [Any] { if let appearance = color["appearances"] as? [Any] {
// Appearance is define only for dark appearance // Appearance is define only for dark appearance
let firstAppearance = appearance.first! as! [String: Any] let firstAppearance = try #require(appearance.first as? [String: Any])
XCTAssertEqual(firstAppearance["value"] as! String, "dark") #expect(firstAppearance["value"] as? String == "dark")
let subColor = color["color"] as! [String: Any] #expect(components["alpha"] as? String == "0xFF")
let components = subColor["components"] as! [String: Any] #expect(components["blue"] as? String == "0xFF")
XCTAssertEqual(components["alpha"] as! String, "0xFF") #expect(components["green"] as? String == "0x00")
XCTAssertEqual(components["blue"] as! String, "0xFF") #expect(components["red"] as? String == "0x00")
XCTAssertEqual(components["green"] as! String, "0x00")
XCTAssertEqual(components["red"] as! String, "0x00")
} else { } else {
let subColor = color["color"] as! [String: Any] #expect(components["alpha"] as? String == "0xFF")
let components = subColor["components"] as! [String: Any] #expect(components["blue"] as? String == "0x00")
XCTAssertEqual(components["alpha"] as! String, "0xFF") #expect(components["green"] as? String == "0x00")
XCTAssertEqual(components["blue"] as! String, "0x00") #expect(components["red"] as? String == "0xFF")
XCTAssertEqual(components["green"] as! String, "0x00")
XCTAssertEqual(components["red"] as! String, "0xFF")
} }
} }
} }
@@ -10,7 +10,7 @@ import Foundation
extension String { extension String {
/// Remove all new lines and leading/trailing whitespaces /// Remove all new lines and leading/trailing whitespaces
func adaptForXCTest() -> Self { func adaptForTest() -> Self {
self self
.split(separator: "\n") .split(separator: "\n")
.compactMap { String($0).removeLeadingTrailingWhitespace() } .compactMap { String($0).removeLeadingTrailingWhitespace() }
@@ -6,14 +6,15 @@
// //
import Foundation import Foundation
import XCTest import Testing
import ToolCore import ToolCore
@testable import ResgenSwift @testable import ResgenSwift
final class FontExtensionGeneratorTests: XCTestCase { struct FontExtensionGeneratorTests {
func test_uiKit_GeneratedExtensionContent() { @Test
func uiKit_GeneratedExtensionContent() {
// Given // Given
let fontNames: [FontName] = [ let fontNames: [FontName] = [
FontName(postscriptName: "CircularStd-Regular", filename: "CircularStd-Regular", fileExtension: "ttf"), FontName(postscriptName: "CircularStd-Regular", filename: "CircularStd-Regular", fileExtension: "ttf"),
@@ -55,11 +56,14 @@ final class FontExtensionGeneratorTests: XCTestCase {
} }
""" """
XCTAssertEqual(extensionContent.adaptForXCTest(), expect.adaptForXCTest()) #expect(extensionContent.adaptForTest() == expect.adaptForTest())
} }
func test_swiftUI_GeneratedExtensionContent() { @Test
func swiftUI_GeneratedExtensionContent() {
// Given // Given
let fontNames: [FontName] = [ let fontNames: [FontName] = [
FontName(postscriptName: "CircularStd-Regular", filename: "CircularStd-Regular", fileExtension: "ttf"), FontName(postscriptName: "CircularStd-Regular", filename: "CircularStd-Regular", fileExtension: "ttf"),
@@ -101,6 +105,6 @@ final class FontExtensionGeneratorTests: XCTestCase {
} }
""" """
XCTAssertEqual(extensionContent.adaptForXCTest(), expect.adaptForXCTest()) #expect(extensionContent.adaptForTest() == expect.adaptForTest())
} }
} }
@@ -6,13 +6,14 @@
// //
import Foundation import Foundation
import XCTest import Testing
@testable import ResgenSwift @testable import ResgenSwift
final class FontNameTests: XCTestCase { struct FontNameTests {
func test_uiKit_GeneratedProperty_noForbiddenCharacter() { @Test
func uiKit_GeneratedProperty_noForbiddenCharacter() {
// Given // Given
let fontName = FontName( let fontName = FontName(
postscriptName: "CircularStdBold", postscriptName: "CircularStdBold",
@@ -34,10 +35,11 @@ final class FontNameTests: XCTestCase {
} }
""" """
XCTAssertEqual(property.adaptForXCTest(), expect.adaptForXCTest()) #expect(property.adaptForTest() == expect.adaptForTest())
} }
func test_uiKit_GeneratedProperty_withForbiddenCharacter() { @Test
func uiKit_GeneratedProperty_withForbiddenCharacter() {
// Given // Given
let fontName = FontName( let fontName = FontName(
postscriptName: "[Circular_Std+Bold-Underline]", postscriptName: "[Circular_Std+Bold-Underline]",
@@ -59,10 +61,11 @@ final class FontNameTests: XCTestCase {
} }
""" """
XCTAssertEqual(property.adaptForXCTest(), expect.adaptForXCTest()) #expect(property.adaptForTest() == expect.adaptForTest())
} }
func test_uiKit_GeneratedMethod_noForbiddenCharacter() { @Test
func uiKit_GeneratedMethod_noForbiddenCharacter() {
// Given // Given
let fontName = FontName( let fontName = FontName(
postscriptName: "CircularStdBold", postscriptName: "CircularStdBold",
@@ -84,10 +87,11 @@ final class FontNameTests: XCTestCase {
} }
""" """
XCTAssertEqual(property.adaptForXCTest(), expect.adaptForXCTest()) #expect(property.adaptForTest() == expect.adaptForTest())
} }
func test_uiKit_GeneratedMethod_withForbiddenCharacter() { @Test
func uiKit_GeneratedMethod_withForbiddenCharacter() {
// Given // Given
let fontName = FontName( let fontName = FontName(
postscriptName: "[Circular_Std+Bold-Underline]", postscriptName: "[Circular_Std+Bold-Underline]",
@@ -109,10 +113,11 @@ final class FontNameTests: XCTestCase {
} }
""" """
XCTAssertEqual(property.adaptForXCTest(), expect.adaptForXCTest()) #expect(property.adaptForTest() == expect.adaptForTest())
} }
func test_swiftUI_GeneratedProperty_noForbiddenCharacter() { @Test
func swiftUI_GeneratedProperty_noForbiddenCharacter() {
// Given // Given
let fontName = FontName( let fontName = FontName(
postscriptName: "CircularStdBold", postscriptName: "CircularStdBold",
@@ -134,10 +139,11 @@ final class FontNameTests: XCTestCase {
} }
""" """
XCTAssertEqual(property.adaptForXCTest(), expect.adaptForXCTest()) #expect(property.adaptForTest() == expect.adaptForTest())
} }
func test_swiftUI_GeneratedProperty_withForbiddenCharacter() { @Test
func swiftUI_GeneratedProperty_withForbiddenCharacter() {
// Given // Given
let fontName = FontName( let fontName = FontName(
postscriptName: "[Circular_Std+Bold-Underline]", postscriptName: "[Circular_Std+Bold-Underline]",
@@ -159,10 +165,11 @@ final class FontNameTests: XCTestCase {
} }
""" """
XCTAssertEqual(property.adaptForXCTest(), expect.adaptForXCTest()) #expect(property.adaptForTest() == expect.adaptForTest())
} }
func test_swiftUI_GeneratedMethod_noForbiddenCharacter() { @Test
func swiftUI_GeneratedMethod_noForbiddenCharacter() {
// Given // Given
let fontName = FontName( let fontName = FontName(
postscriptName: "CircularStdBold", postscriptName: "CircularStdBold",
@@ -184,10 +191,11 @@ final class FontNameTests: XCTestCase {
} }
""" """
XCTAssertEqual(property.adaptForXCTest(), expect.adaptForXCTest()) #expect(property.adaptForTest() == expect.adaptForTest())
} }
func test_swiftUI_GeneratedMethod_withForbiddenCharacter() { @Test
func swiftUI_GeneratedMethod_withForbiddenCharacter() {
// Given // Given
let fontName = FontName( let fontName = FontName(
postscriptName: "[Circular_Std+Bold-Underline]", postscriptName: "[Circular_Std+Bold-Underline]",
@@ -209,6 +217,6 @@ final class FontNameTests: XCTestCase {
} }
""" """
XCTAssertEqual(property.adaptForXCTest(), expect.adaptForXCTest()) #expect(property.adaptForTest() == expect.adaptForTest())
} }
} }
@@ -6,12 +6,13 @@
// //
import Foundation import Foundation
import XCTest import Testing
@testable import ResgenSwift @testable import ResgenSwift
final class FontPlistGeneratorTests: XCTestCase { struct FontPlistGeneratorTests {
func testGeneratedPlist() { @Test
func generatedPlist() {
// Given // Given
let fontNames: [FontName] = [ let fontNames: [FontName] = [
FontName(postscriptName: "CircularStd-Regular", filename: "CircularStd-Regular", fileExtension: "ttf"), FontName(postscriptName: "CircularStd-Regular", filename: "CircularStd-Regular", fileExtension: "ttf"),
@@ -30,6 +31,6 @@ final class FontPlistGeneratorTests: XCTestCase {
</array> </array>
""" """
XCTAssertEqual(plistContent.adaptForXCTest(), expect.adaptForXCTest()) #expect(plistContent.adaptForTest() == expect.adaptForTest())
} }
} }
@@ -7,13 +7,14 @@
import Foundation import Foundation
@testable import ResgenSwift @testable import ResgenSwift
import XCTest import Testing
final class AnalyticsConfigurationTests: XCTestCase { struct AnalyticsConfigurationTests {
let projectDirectory = "projectDirectory/" let projectDirectory = "projectDirectory/"
func test_argsGeneration_requiredArgs() { @Test
func argsGeneration_requiredArgs() {
// Given // Given
let testingConfiguration = AnalyticsConfiguration( let testingConfiguration = AnalyticsConfiguration(
inputFile: "path/to/tags.yml", inputFile: "path/to/tags.yml",
@@ -39,10 +40,11 @@ final class AnalyticsConfigurationTests: XCTestCase {
"projectDirectory/Analytics/Generated/AnalyticsManager.swift", "projectDirectory/Analytics/Generated/AnalyticsManager.swift",
] ]
XCTAssertEqual(arguments, expectedArguments) #expect(arguments == expectedArguments)
} }
func test_argsGeneration_allArguments() { @Test
func argsGeneration_allArguments() {
// Given // Given
let testingConfiguration = AnalyticsConfiguration( let testingConfiguration = AnalyticsConfiguration(
inputFile: "path/to/tags.yml", inputFile: "path/to/tags.yml",
@@ -75,6 +77,6 @@ final class AnalyticsConfigurationTests: XCTestCase {
"mySuffix" "mySuffix"
] ]
XCTAssertEqual(arguments, expectedArguments) #expect(arguments == expectedArguments)
} }
} }
@@ -6,15 +6,16 @@
// //
import Foundation import Foundation
import XCTest import Testing
@testable import ResgenSwift @testable import ResgenSwift
final class ColorsConfigurationTests: XCTestCase { struct ColorsConfigurationTests {
let projectDirectory = "projectDirectory/" let projectDirectory = "projectDirectory/"
func test_argsGeneration_requiredArgs() { @Test
func argsGeneration_requiredArgs() {
// Given // Given
let testingConfiguration = ColorsConfiguration( let testingConfiguration = ColorsConfiguration(
inputFile: "path/to/colors.txt", inputFile: "path/to/colors.txt",
@@ -45,10 +46,11 @@ final class ColorsConfigurationTests: XCTestCase {
"false" "false"
] ]
XCTAssertEqual(arguments, expectedArguments) #expect(arguments == expectedArguments)
} }
func test_argsGeneration_allArguments() { @Test
func argsGeneration_allArguments() {
// Given // Given
let testingConfiguration = ColorsConfiguration( let testingConfiguration = ColorsConfiguration(
inputFile: "path/to/colors.txt", inputFile: "path/to/colors.txt",
@@ -92,6 +94,6 @@ final class ColorsConfigurationTests: XCTestCase {
"false" "false"
] ]
XCTAssertEqual(arguments, expectedArguments) #expect(arguments == expectedArguments)
} }
} }
@@ -6,15 +6,16 @@
// //
import Foundation import Foundation
import XCTest import Testing
@testable import ResgenSwift @testable import ResgenSwift
final class FontsConfigurationTests: XCTestCase { struct FontsConfigurationTests {
let projectDirectory = "projectDirectory/" let projectDirectory = "projectDirectory/"
func test_argsGeneration_requiredArgs() { @Test
func argsGeneration_requiredArgs() {
// Given // Given
let testingConfiguration = FontsConfiguration( let testingConfiguration = FontsConfiguration(
inputFile: "path/to/fonts.txt", inputFile: "path/to/fonts.txt",
@@ -37,10 +38,11 @@ final class FontsConfigurationTests: XCTestCase {
"projectDirectory/path/to/fonts.txt" "projectDirectory/path/to/fonts.txt"
] ]
XCTAssertEqual(arguments, expectedArguments) #expect(arguments == expectedArguments)
} }
func test_argsGeneration_allArguments() { @Test
func argsGeneration_allArguments() {
// Given // Given
let testingConfiguration = FontsConfiguration( let testingConfiguration = FontsConfiguration(
inputFile: "path/to/fonts.txt", inputFile: "path/to/fonts.txt",
@@ -78,6 +80,6 @@ final class FontsConfigurationTests: XCTestCase {
"projectDirectory/path/to/plist1.plist projectDirectory/path/to/plist2.plist" "projectDirectory/path/to/plist1.plist projectDirectory/path/to/plist2.plist"
] ]
XCTAssertEqual(arguments, expectedArguments) #expect(arguments == expectedArguments)
} }
} }
@@ -6,15 +6,16 @@
// //
import Foundation import Foundation
import XCTest import Testing
@testable import ResgenSwift @testable import ResgenSwift
final class ImagesConfigurationTests: XCTestCase { struct ImagesConfigurationTests {
let projectDirectory = "projectDirectory/" let projectDirectory = "projectDirectory/"
func test_argsGeneration_requiredArgs() { @Test
func argsGeneration_requiredArgs() {
// Given // Given
let testingConfiguration = ImagesConfiguration( let testingConfiguration = ImagesConfiguration(
inputFile: "path/to/images.txt", inputFile: "path/to/images.txt",
@@ -41,10 +42,11 @@ final class ImagesConfigurationTests: XCTestCase {
"projectDirectory/path/to/assets.xcassets" "projectDirectory/path/to/assets.xcassets"
] ]
XCTAssertEqual(arguments, expectedArguments) #expect(arguments == expectedArguments)
} }
func test_argsGeneration_allArguments() { @Test
func argsGeneration_allArguments() {
// Given // Given
let testingConfiguration = ImagesConfiguration( let testingConfiguration = ImagesConfiguration(
inputFile: "path/to/images.txt", inputFile: "path/to/images.txt",
@@ -86,7 +88,7 @@ final class ImagesConfigurationTests: XCTestCase {
"true" "true"
] ]
XCTAssertEqual(arguments, expectedArguments) #expect(arguments == expectedArguments)
} }
} }
@@ -7,13 +7,14 @@
import Foundation import Foundation
@testable import ResgenSwift @testable import ResgenSwift
import XCTest import Testing
final class StringsConfigurationTests: XCTestCase { struct StringsConfigurationTests {
let projectDirectory = "projectDirectory/" let projectDirectory = "projectDirectory/"
func test_argsGeneration_requiredArgs() { @Test
func argsGeneration_requiredArgs() {
// Given // Given
let testingConfiguration = StringsConfiguration( let testingConfiguration = StringsConfiguration(
inputFile: "path/to/strings.txt", inputFile: "path/to/strings.txt",
@@ -46,10 +47,11 @@ final class StringsConfigurationTests: XCTestCase {
"en" "en"
] ]
XCTAssertEqual(arguments, expectedArguments) #expect(arguments == expectedArguments)
} }
func test_argsGeneration_allArguments() { @Test
func argsGeneration_allArguments() {
// Given // Given
let testingConfiguration = StringsConfiguration( let testingConfiguration = StringsConfiguration(
inputFile: "path/to/strings.txt", inputFile: "path/to/strings.txt",
@@ -97,6 +99,6 @@ final class StringsConfigurationTests: XCTestCase {
"true" "true"
] ]
XCTAssertEqual(arguments, expectedArguments) #expect(arguments == expectedArguments)
} }
} }
@@ -7,13 +7,14 @@
import Foundation import Foundation
@testable import ResgenSwift @testable import ResgenSwift
import XCTest import Testing
final class TagsConfigurationTests: XCTestCase { struct TagsConfigurationTests {
let projectDirectory = "projectDirectory/" let projectDirectory = "projectDirectory/"
func test_argsGeneration_requiredArgs() { @Test
func argsGeneration_requiredArgs() {
// Given // Given
let testingConfiguration = TagsConfiguration( let testingConfiguration = TagsConfiguration(
inputFile: "path/to/tags.txt", inputFile: "path/to/tags.txt",
@@ -40,10 +41,11 @@ final class TagsConfigurationTests: XCTestCase {
"projectDirectory/Tags/Generated" "projectDirectory/Tags/Generated"
] ]
XCTAssertEqual(arguments, expectedArguments) #expect(arguments == expectedArguments)
} }
func test_argsGeneration_allArguments() { @Test
func argsGeneration_allArguments() {
// Given // Given
let testingConfiguration = TagsConfiguration( let testingConfiguration = TagsConfiguration(
inputFile: "path/to/tags.txt", inputFile: "path/to/tags.txt",
@@ -79,6 +81,6 @@ final class TagsConfigurationTests: XCTestCase {
"true" "true"
] ]
XCTAssertEqual(arguments, expectedArguments) #expect(arguments == expectedArguments)
} }
} }
@@ -6,14 +6,15 @@
// //
import Foundation import Foundation
import XCTest import Testing
import ToolCore import ToolCore
@testable import ResgenSwift @testable import ResgenSwift
final class ImageExtensionGeneratorTests: XCTestCase { struct ImageExtensionGeneratorTests {
func test_uiKit_GeneratedExtensionContent() { @Test
func uiKit_GeneratedExtensionContent() {
// Given // Given
let images = [ let images = [
ParsedImage(name: "image_one", tags: "id", width: 10, height: 10), ParsedImage(name: "image_one", tags: "id", width: 10, height: 10),
@@ -50,10 +51,11 @@ final class ImageExtensionGeneratorTests: XCTestCase {
} }
""" """
XCTAssertEqual(extensionContent.adaptForXCTest(), expect.adaptForXCTest()) #expect(extensionContent.adaptForTest() == expect.adaptForTest())
} }
func test_uiKit_GeneratedExtensionContentForIsStatic() { @Test
func uiKit_GeneratedExtensionContentForIsStatic() {
// Given // Given
let images = [ let images = [
ParsedImage(name: "image_one", tags: "id", width: 10, height: 10), ParsedImage(name: "image_one", tags: "id", width: 10, height: 10),
@@ -90,10 +92,11 @@ final class ImageExtensionGeneratorTests: XCTestCase {
} }
""" """
XCTAssertEqual(extensionContent.adaptForXCTest(), expect.adaptForXCTest()) #expect(extensionContent.adaptForTest() == expect.adaptForTest())
} }
func test_swiftUI_GeneratedExtensionContent() { @Test
func swiftUI_GeneratedExtensionContent() {
// Given // Given
let images = [ let images = [
ParsedImage(name: "image_one", tags: "id", width: 10, height: 10), ParsedImage(name: "image_one", tags: "id", width: 10, height: 10),
@@ -130,10 +133,11 @@ final class ImageExtensionGeneratorTests: XCTestCase {
} }
""" """
XCTAssertEqual(extensionContent.adaptForXCTest(), expect.adaptForXCTest()) #expect(extensionContent.adaptForTest() == expect.adaptForTest())
} }
func test_swiftUI_GeneratedExtensionContentForIsStatic() { @Test
func swiftUI_GeneratedExtensionContentForIsStatic() {
// Given // Given
let images = [ let images = [
ParsedImage(name: "image_one", tags: "id", width: 10, height: 10), ParsedImage(name: "image_one", tags: "id", width: 10, height: 10),
@@ -170,6 +174,6 @@ final class ImageExtensionGeneratorTests: XCTestCase {
} }
""" """
XCTAssertEqual(extensionContent.adaptForXCTest(), expect.adaptForXCTest()) #expect(extensionContent.adaptForTest() == expect.adaptForTest())
} }
} }
@@ -6,12 +6,13 @@
// //
import Foundation import Foundation
import XCTest import Testing
@testable import ResgenSwift @testable import ResgenSwift
class ImageFileParserTests: XCTestCase { struct ImageFileParserTests {
func testParseImagesFile() { @Test
func parseImagesFile() throws {
// Given // Given
let input = """ let input = """
# #
@@ -29,24 +30,24 @@ class ImageFileParserTests: XCTestCase {
platform: PlatormTag.ios) platform: PlatormTag.ios)
// Expect // Expect
XCTAssertEqual(parsedImages.count, 2) #expect(parsedImages.count == 2)
let firstImage = parsedImages.first { let firstImage = try #require(parsedImages.first {
$0.name == "image_one" $0.name == "image_one"
} })
XCTAssertEqual(firstImage!.name, "image_one") #expect(firstImage.name == "image_one")
XCTAssertEqual(firstImage!.tags, "id") #expect(firstImage.tags == "id")
XCTAssertEqual(firstImage!.width, 25) #expect(firstImage.width == 25)
XCTAssertEqual(firstImage!.height, -1) #expect(firstImage.height == -1)
XCTAssertEqual(firstImage!.imageExtensions, [.png]) #expect(firstImage.imageExtensions == [.png])
let secondImage = parsedImages.first { let secondImage = try #require(parsedImages.first {
$0.name == "image_two" $0.name == "image_two"
} })
XCTAssertEqual(secondImage!.name, "image_two") #expect(secondImage.name == "image_two")
XCTAssertEqual(secondImage!.tags, "di") #expect(secondImage.tags == "di")
XCTAssertEqual(secondImage!.width, -1) #expect(secondImage.width == -1)
XCTAssertEqual(secondImage!.height, 50) #expect(secondImage.height == 50)
XCTAssertEqual(firstImage!.imageExtensions, [.png]) #expect(firstImage.imageExtensions == [.png])
} }
} }
@@ -6,13 +6,14 @@
// //
import Foundation import Foundation
import XCTest import Testing
@testable import ResgenSwift @testable import ResgenSwift
final class ParsedImageTests: XCTestCase { struct ParsedImageTests {
func testConvertArguments() { @Test
func convertArguments() {
// Given // Given
let imageName = "the_name" let imageName = "the_name"
let parsedImage = ParsedImage(name: imageName, let parsedImage = ParsedImage(name: imageName,
@@ -24,17 +25,18 @@ final class ParsedImageTests: XCTestCase {
let convertArguments = parsedImage.convertArguments let convertArguments = parsedImage.convertArguments
// Expect // Expect
XCTAssertEqual(convertArguments.x1.width, "10") #expect(convertArguments.x1.width == "10")
XCTAssertEqual(convertArguments.x1.height, "10") #expect(convertArguments.x1.height == "10")
XCTAssertEqual(convertArguments.x2.width, "20") #expect(convertArguments.x2.width == "20")
XCTAssertEqual(convertArguments.x2.height, "20") #expect(convertArguments.x2.height == "20")
XCTAssertEqual(convertArguments.x3.width, "30") #expect(convertArguments.x3.width == "30")
XCTAssertEqual(convertArguments.x3.height, "30") #expect(convertArguments.x3.height == "30")
} }
func test_uiKit_GeneratedProperty() { @Test
func uiKit_GeneratedProperty() {
// Given // Given
let imageName = "the_name" let imageName = "the_name"
let parsedImage = ParsedImage( let parsedImage = ParsedImage(
@@ -59,10 +61,11 @@ final class ParsedImageTests: XCTestCase {
} }
""" """
XCTAssertEqual(property.adaptForXCTest(), expect.adaptForXCTest()) #expect(property.adaptForTest() == expect.adaptForTest())
} }
func test_uiKit_GeneratedStaticProperty() { @Test
func uiKit_GeneratedStaticProperty() {
// Given // Given
let imageName = "the_name" let imageName = "the_name"
let parsedImage = ParsedImage( let parsedImage = ParsedImage(
@@ -87,10 +90,11 @@ final class ParsedImageTests: XCTestCase {
} }
""" """
XCTAssertEqual(property.adaptForXCTest(), expect.adaptForXCTest()) #expect(property.adaptForTest() == expect.adaptForTest())
} }
func test_swiftUI_GeneratedProperty() { @Test
func swiftUI_GeneratedProperty() {
// Given // Given
let imageName = "the_name" let imageName = "the_name"
let parsedImage = ParsedImage( let parsedImage = ParsedImage(
@@ -115,10 +119,11 @@ final class ParsedImageTests: XCTestCase {
} }
""" """
XCTAssertEqual(property.adaptForXCTest(), expect.adaptForXCTest()) #expect(property.adaptForTest() == expect.adaptForTest())
} }
func test_swiftUI_GeneratedStaticProperty() { @Test
func swiftUI_GeneratedStaticProperty() {
// Given // Given
let imageName = "the_name" let imageName = "the_name"
let parsedImage = ParsedImage( let parsedImage = ParsedImage(
@@ -143,10 +148,11 @@ final class ParsedImageTests: XCTestCase {
} }
""" """
XCTAssertEqual(property.adaptForXCTest(), expect.adaptForXCTest()) #expect(property.adaptForTest() == expect.adaptForTest())
} }
func testAssetContentJson() { @Test
func assetContentJson() {
// Given // Given
let imageName = "the_name" let imageName = "the_name"
let parsedImage = ParsedImage( let parsedImage = ParsedImage(
@@ -184,10 +190,11 @@ final class ParsedImageTests: XCTestCase {
) )
) )
XCTAssertEqual(property, expect) #expect(property == expect)
} }
func testAssetPng() { @Test
func assetPng() {
// Given // Given
let imageName = "the_name" let imageName = "the_name"
let parsedImage = ParsedImage(name: imageName, let parsedImage = ParsedImage(name: imageName,
@@ -228,6 +235,6 @@ final class ParsedImageTests: XCTestCase {
debugPrint(property) debugPrint(property)
debugPrint(expect) debugPrint(expect)
XCTAssertEqual(property, expect) #expect(property == expect)
} }
} }
+19 -26
View File
@@ -1,25 +1,17 @@
import XCTest import Foundation
import class Foundation.Bundle import Testing
@testable import ResgenSwift @testable import ResgenSwift
final class ResgenCLITests: XCTestCase { struct ResgenCLITests {
func testExample() throws {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct
// results.
// Some of the APIs that we use below are available in macOS 10.13 and above.
guard #available(macOS 10.13, *) else {
return
}
/// Smoke test: the built executable launches and exits.
@Test
func executableRuns() throws {
// Process available on Mac only // Process available on Mac only
#if os(macOS) #if os(macOS)
let fooBinary = productsDirectory.appendingPathComponent("ResgenSwift")
let process = Process() let process = Process()
process.executableURL = fooBinary process.executableURL = try productsDirectory().appendingPathComponent("ResgenSwift")
let pipe = Pipe() let pipe = Pipe()
process.standardOutput = pipe process.standardOutput = pipe
@@ -28,21 +20,22 @@ final class ResgenCLITests: XCTestCase {
process.waitUntilExit() process.waitUntilExit()
let data = pipe.fileHandleForReading.readDataToEndOfFile() let data = pipe.fileHandleForReading.readDataToEndOfFile()
let output = String(data: data, encoding: .utf8) #expect(String(data: data, encoding: .utf8) != nil)
XCTAssertEqual(output, output)//"Hello, world!\n")
#endif #endif
} }
/// Returns path to the built products directory. /// Returns path to the built products directory.
var productsDirectory: URL { private func productsDirectory() throws -> URL {
#if os(macOS) #if os(macOS)
for bundle in Bundle.allBundles where bundle.bundlePath.hasSuffix(".xctest") { // Swift Testing does not register the test bundle in `Bundle.allBundles`,
return bundle.bundleURL.deletingLastPathComponent() // so resolve it from a class compiled into this test target.
} let bundle = Bundle(for: BundleToken.self)
fatalError("couldn't find the products directory") try #require(bundle.bundlePath.hasSuffix(".xctest"))
#else return bundle.bundleURL.deletingLastPathComponent()
#else
return Bundle.main.bundleURL return Bundle.main.bundleURL
#endif #endif
} }
} }
private final class BundleToken {}
@@ -10,25 +10,26 @@
import Foundation import Foundation
@testable import ResgenSwift @testable import ResgenSwift
import ToolCore import ToolCore
import XCTest import Testing
final class DefinitionTests: XCTestCase { struct DefinitionTests {
// MARK: - Match line // MARK: - Match line
func testMatchingDefinition() { @Test
func matchingDefinition() throws {
// Given // Given
let line = "[definition_name]" let line = "[definition_name]"
// When // When
let definition = Definition.match(line) let definition = try #require(Definition.match(line))
// Expect // Expect
XCTAssertNotNil(definition) #expect(definition.name == "definition_name")
XCTAssertEqual(definition?.name, "definition_name")
} }
func testNotMatchingDefinition() { @Test
func notMatchingDefinition() {
// Given // Given
let line1 = "definition_name" let line1 = "definition_name"
let line2 = "[definition_name" let line2 = "[definition_name"
@@ -40,14 +41,15 @@ final class DefinitionTests: XCTestCase {
let definition3 = Definition.match(line3) let definition3 = Definition.match(line3)
// Expect // Expect
XCTAssertNil(definition1) #expect(definition1 == nil)
XCTAssertNil(definition2) #expect(definition2 == nil)
XCTAssertNil(definition3) #expect(definition3 == nil)
} }
// MARK: - Matching tags // MARK: - Matching tags
func testMatchingTags() { @Test
func matchingTags() {
// Given // Given
let definition = Definition(name: "definition_name") let definition = Definition(name: "definition_name")
definition.tags = ["ios","iosonly","notranslation"] definition.tags = ["ios","iosonly","notranslation"]
@@ -59,12 +61,13 @@ final class DefinitionTests: XCTestCase {
// Expect // Expect
XCTAssertTrue(match1) #expect(match1)
XCTAssertTrue(match2) #expect(match2)
XCTAssertTrue(match3) #expect(match3)
} }
func testNotMatchingTags() { @Test
func notMatchingTags() {
// Given // Given
let definition = Definition(name: "definition_name") let definition = Definition(name: "definition_name")
definition.tags = ["ios","iosonly","notranslation"] definition.tags = ["ios","iosonly","notranslation"]
@@ -75,14 +78,15 @@ final class DefinitionTests: XCTestCase {
let match3 = definition.hasOneOrMoreMatchingTags(inputTags: ["azerty"]) let match3 = definition.hasOneOrMoreMatchingTags(inputTags: ["azerty"])
// Expect // Expect
XCTAssertFalse(match1) #expect(match1 == false)
XCTAssertFalse(match2) #expect(match2 == false)
XCTAssertFalse(match3) #expect(match3 == false)
} }
// MARK: - getNSLocalizedStringProperty // MARK: - getNSLocalizedStringProperty
func testGeneratedNSLocalizedStringProperty() { @Test
func generatedNSLocalizedStringProperty() {
// Given // Given
let definition = Definition(name: "definition_name") let definition = Definition(name: "definition_name")
definition.tags = ["ios","iosonly","notranslation"] definition.tags = ["ios","iosonly","notranslation"]
@@ -147,12 +151,13 @@ final class DefinitionTests: XCTestCase {
} }
""" """
XCTAssertEqual(propertyFr.adaptForXCTest(), expectFr.adaptForXCTest()) #expect(propertyFr.adaptForTest() == expectFr.adaptForTest())
XCTAssertEqual(propertyEn.adaptForXCTest(), expectEn.adaptForXCTest()) #expect(propertyEn.adaptForTest() == expectEn.adaptForTest())
XCTAssertEqual(propertyEnUs.adaptForXCTest(), expectEnUs.adaptForXCTest()) #expect(propertyEnUs.adaptForTest() == expectEnUs.adaptForTest())
} }
func testGeneratedNSLocalizedStringPropertyWithEmptyComment() { @Test
func generatedNSLocalizedStringPropertyWithEmptyComment() {
// Given // Given
let definition = Definition(name: "definition_name") let definition = Definition(name: "definition_name")
definition.tags = ["ios","iosonly","notranslation"] definition.tags = ["ios","iosonly","notranslation"]
@@ -217,12 +222,13 @@ final class DefinitionTests: XCTestCase {
} }
""" """
XCTAssertEqual(propertyFr.adaptForXCTest(), expectFr.adaptForXCTest()) #expect(propertyFr.adaptForTest() == expectFr.adaptForTest())
XCTAssertEqual(propertyEn.adaptForXCTest(), expectEn.adaptForXCTest()) #expect(propertyEn.adaptForTest() == expectEn.adaptForTest())
XCTAssertEqual(propertyEnUs.adaptForXCTest(), expectEnUs.adaptForXCTest()) #expect(propertyEnUs.adaptForTest() == expectEnUs.adaptForTest())
} }
func testGeneratedNSLocalizedStringPropertyWithNoComment() { @Test
func generatedNSLocalizedStringPropertyWithNoComment() {
// Given // Given
let definition = Definition(name: "definition_name") let definition = Definition(name: "definition_name")
definition.tags = ["ios","iosonly","notranslation"] definition.tags = ["ios","iosonly","notranslation"]
@@ -286,14 +292,15 @@ final class DefinitionTests: XCTestCase {
} }
""" """
XCTAssertEqual(propertyFr.adaptForXCTest(), expectFr.adaptForXCTest()) #expect(propertyFr.adaptForTest() == expectFr.adaptForTest())
XCTAssertEqual(propertyEn.adaptForXCTest(), expectEn.adaptForXCTest()) #expect(propertyEn.adaptForTest() == expectEn.adaptForTest())
XCTAssertEqual(propertyEnUs.adaptForXCTest(), expectEnUs.adaptForXCTest()) #expect(propertyEnUs.adaptForTest() == expectEnUs.adaptForTest())
} }
// MARK: - getNSLocalizedStringProperty - static // MARK: - getNSLocalizedStringProperty - static
func testGeneratedNSLocalizedStringStaticProperty() { @Test
func generatedNSLocalizedStringStaticProperty() {
// Given // Given
let definition = Definition(name: "definition_name") let definition = Definition(name: "definition_name")
definition.tags = ["ios","iosonly","notranslation"] definition.tags = ["ios","iosonly","notranslation"]
@@ -358,12 +365,13 @@ final class DefinitionTests: XCTestCase {
} }
""" """
XCTAssertEqual(propertyFr.adaptForXCTest(), expectFr.adaptForXCTest()) #expect(propertyFr.adaptForTest() == expectFr.adaptForTest())
XCTAssertEqual(propertyEn.adaptForXCTest(), expectEn.adaptForXCTest()) #expect(propertyEn.adaptForTest() == expectEn.adaptForTest())
XCTAssertEqual(propertyEnUs.adaptForXCTest(), expectEnUs.adaptForXCTest()) #expect(propertyEnUs.adaptForTest() == expectEnUs.adaptForTest())
} }
func testGeneratedNSLocalizedStringStaticPropertyWithEmptyComment() { @Test
func generatedNSLocalizedStringStaticPropertyWithEmptyComment() {
// Given // Given
let definition = Definition(name: "definition_name") let definition = Definition(name: "definition_name")
definition.tags = ["ios","iosonly","notranslation"] definition.tags = ["ios","iosonly","notranslation"]
@@ -428,12 +436,13 @@ final class DefinitionTests: XCTestCase {
} }
""" """
XCTAssertEqual(propertyFr.adaptForXCTest(), expectFr.adaptForXCTest()) #expect(propertyFr.adaptForTest() == expectFr.adaptForTest())
XCTAssertEqual(propertyEn.adaptForXCTest(), expectEn.adaptForXCTest()) #expect(propertyEn.adaptForTest() == expectEn.adaptForTest())
XCTAssertEqual(propertyEnUs.adaptForXCTest(), expectEnUs.adaptForXCTest()) #expect(propertyEnUs.adaptForTest() == expectEnUs.adaptForTest())
} }
func testGeneratedNSLocalizedStringStaticPropertyWithNoComment() { @Test
func generatedNSLocalizedStringStaticPropertyWithNoComment() {
// Given // Given
let definition = Definition(name: "definition_name") let definition = Definition(name: "definition_name")
definition.tags = ["ios","iosonly","notranslation"] definition.tags = ["ios","iosonly","notranslation"]
@@ -497,12 +506,13 @@ final class DefinitionTests: XCTestCase {
} }
""" """
XCTAssertEqual(propertyFr.adaptForXCTest(), expectFr.adaptForXCTest()) #expect(propertyFr.adaptForTest() == expectFr.adaptForTest())
XCTAssertEqual(propertyEn.adaptForXCTest(), expectEn.adaptForXCTest()) #expect(propertyEn.adaptForTest() == expectEn.adaptForTest())
XCTAssertEqual(propertyEnUs.adaptForXCTest(), expectEnUs.adaptForXCTest()) #expect(propertyEnUs.adaptForTest() == expectEnUs.adaptForTest())
} }
func testGeneratedNSLocalizedStringPropertyWithOneArgument() { @Test
func generatedNSLocalizedStringPropertyWithOneArgument() {
// Given // Given
let definition = Definition(name: "definition_name") let definition = Definition(name: "definition_name")
definition.tags = ["ios","iosonly","notranslation"] definition.tags = ["ios","iosonly","notranslation"]
@@ -540,10 +550,11 @@ final class DefinitionTests: XCTestCase {
} }
""" """
XCTAssertEqual(propertyFr.adaptForXCTest(), expectFr.adaptForXCTest()) #expect(propertyFr.adaptForTest() == expectFr.adaptForTest())
} }
func testGeneratedNSLocalizedStringPropertyWithMultipleArgument() { @Test
func generatedNSLocalizedStringPropertyWithMultipleArgument() {
// Given // Given
let definition = Definition(name: "definition_name") let definition = Definition(name: "definition_name")
definition.tags = ["ios","iosonly","notranslation"] definition.tags = ["ios","iosonly","notranslation"]
@@ -581,10 +592,11 @@ final class DefinitionTests: XCTestCase {
} }
""" """
XCTAssertEqual(propertyFr.adaptForXCTest(), expectFr.adaptForXCTest()) #expect(propertyFr.adaptForTest() == expectFr.adaptForTest())
} }
func testGeneratedNSLocalizedStringPropertyWithNumberedArguments() { @Test
func generatedNSLocalizedStringPropertyWithNumberedArguments() {
// Given // Given
let definition = Definition(name: "definition_name") let definition = Definition(name: "definition_name")
definition.tags = ["ios","iosonly","notranslation"] definition.tags = ["ios","iosonly","notranslation"]
@@ -648,13 +660,14 @@ final class DefinitionTests: XCTestCase {
} }
""" """
XCTAssertEqual(propertyFr.adaptForXCTest(), expectFr.adaptForXCTest()) #expect(propertyFr.adaptForTest() == expectFr.adaptForTest())
XCTAssertEqual(propertyEn.adaptForXCTest(), expectEn.adaptForXCTest()) #expect(propertyEn.adaptForTest() == expectEn.adaptForTest())
} }
// MARK: - Raw properties // MARK: - Raw properties
func testGeneratedRawProperty() { @Test
func generatedRawProperty() {
// Given // Given
let definition = Definition(name: "definition_name") let definition = Definition(name: "definition_name")
definition.tags = ["ios","iosonly","notranslation"] definition.tags = ["ios","iosonly","notranslation"]
@@ -716,12 +729,13 @@ final class DefinitionTests: XCTestCase {
} }
""" """
XCTAssertEqual(propertyFr.adaptForXCTest(), expectFr.adaptForXCTest()) #expect(propertyFr.adaptForTest() == expectFr.adaptForTest())
XCTAssertEqual(propertyEn.adaptForXCTest(), expectEn.adaptForXCTest()) #expect(propertyEn.adaptForTest() == expectEn.adaptForTest())
XCTAssertEqual(propertyEnUs.adaptForXCTest(), expectEnUs.adaptForXCTest()) #expect(propertyEnUs.adaptForTest() == expectEnUs.adaptForTest())
} }
func testGeneratedRawPropertyWithEmptyComment() { @Test
func generatedRawPropertyWithEmptyComment() {
// Given // Given
let definition = Definition(name: "definition_name") let definition = Definition(name: "definition_name")
definition.tags = ["ios","iosonly","notranslation"] definition.tags = ["ios","iosonly","notranslation"]
@@ -783,12 +797,13 @@ final class DefinitionTests: XCTestCase {
} }
""" """
XCTAssertEqual(propertyFr.adaptForXCTest(), expectFr.adaptForXCTest()) #expect(propertyFr.adaptForTest() == expectFr.adaptForTest())
XCTAssertEqual(propertyEn.adaptForXCTest(), expectEn.adaptForXCTest()) #expect(propertyEn.adaptForTest() == expectEn.adaptForTest())
XCTAssertEqual(propertyEnUs.adaptForXCTest(), expectEnUs.adaptForXCTest()) #expect(propertyEnUs.adaptForTest() == expectEnUs.adaptForTest())
} }
func testGeneratedRawPropertyWithNoComment() { @Test
func generatedRawPropertyWithNoComment() {
// Given // Given
let definition = Definition(name: "definition_name") let definition = Definition(name: "definition_name")
definition.tags = ["ios","iosonly","notranslation"] definition.tags = ["ios","iosonly","notranslation"]
@@ -849,14 +864,15 @@ final class DefinitionTests: XCTestCase {
} }
""" """
XCTAssertEqual(propertyFr.adaptForXCTest(), expectFr.adaptForXCTest()) #expect(propertyFr.adaptForTest() == expectFr.adaptForTest())
XCTAssertEqual(propertyEn.adaptForXCTest(), expectEn.adaptForXCTest()) #expect(propertyEn.adaptForTest() == expectEn.adaptForTest())
XCTAssertEqual(propertyEnUs.adaptForXCTest(), expectEnUs.adaptForXCTest()) #expect(propertyEnUs.adaptForTest() == expectEnUs.adaptForTest())
} }
// MARK: - Raw static properties // MARK: - Raw static properties
func testGeneratedRawStaticProperty() { @Test
func generatedRawStaticProperty() {
// Given // Given
let definition = Definition(name: "definition_name") let definition = Definition(name: "definition_name")
definition.tags = ["ios","iosonly","notranslation"] definition.tags = ["ios","iosonly","notranslation"]
@@ -918,12 +934,13 @@ final class DefinitionTests: XCTestCase {
} }
""" """
XCTAssertEqual(propertyFr.adaptForXCTest(), expectFr.adaptForXCTest()) #expect(propertyFr.adaptForTest() == expectFr.adaptForTest())
XCTAssertEqual(propertyEn.adaptForXCTest(), expectEn.adaptForXCTest()) #expect(propertyEn.adaptForTest() == expectEn.adaptForTest())
XCTAssertEqual(propertyEnUs.adaptForXCTest(), expectEnUs.adaptForXCTest()) #expect(propertyEnUs.adaptForTest() == expectEnUs.adaptForTest())
} }
func testGeneratedRawStaticPropertyWithEmptyComment() { @Test
func generatedRawStaticPropertyWithEmptyComment() {
// Given // Given
let definition = Definition(name: "definition_name") let definition = Definition(name: "definition_name")
definition.tags = ["ios","iosonly","notranslation"] definition.tags = ["ios","iosonly","notranslation"]
@@ -985,12 +1002,13 @@ final class DefinitionTests: XCTestCase {
} }
""" """
XCTAssertEqual(propertyFr.adaptForXCTest(), expectFr.adaptForXCTest()) #expect(propertyFr.adaptForTest() == expectFr.adaptForTest())
XCTAssertEqual(propertyEn.adaptForXCTest(), expectEn.adaptForXCTest()) #expect(propertyEn.adaptForTest() == expectEn.adaptForTest())
XCTAssertEqual(propertyEnUs.adaptForXCTest(), expectEnUs.adaptForXCTest()) #expect(propertyEnUs.adaptForTest() == expectEnUs.adaptForTest())
} }
func testGeneratedRawStaticPropertyWithNoComment() { @Test
func generatedRawStaticPropertyWithNoComment() {
// Given // Given
let definition = Definition(name: "definition_name") let definition = Definition(name: "definition_name")
definition.tags = ["ios","iosonly","notranslation"] definition.tags = ["ios","iosonly","notranslation"]
@@ -1051,9 +1069,9 @@ final class DefinitionTests: XCTestCase {
} }
""" """
XCTAssertEqual(propertyFr.adaptForXCTest(), expectFr.adaptForXCTest()) #expect(propertyFr.adaptForTest() == expectFr.adaptForTest())
XCTAssertEqual(propertyEn.adaptForXCTest(), expectEn.adaptForXCTest()) #expect(propertyEn.adaptForTest() == expectEn.adaptForTest())
XCTAssertEqual(propertyEnUs.adaptForXCTest(), expectEnUs.adaptForXCTest()) #expect(propertyEnUs.adaptForTest() == expectEnUs.adaptForTest())
} }
} }
@@ -6,27 +6,28 @@
// //
import Foundation import Foundation
import XCTest import Testing
@testable import ResgenSwift @testable import ResgenSwift
final class SectionTests: XCTestCase { struct SectionTests {
// MARK: - Match line // MARK: - Match line
func testMatchingDefinition() { @Test
func matchingDefinition() throws {
// Given // Given
let line = "[[section_name]]" let line = "[[section_name]]"
// When // When
let section = Section.match(line) let section = try #require(Section.match(line))
// Expect // Expect
XCTAssertNotNil(section) #expect(section.name == "section_name")
XCTAssertEqual(section?.name, "section_name")
} }
func testNotMatchingDefinition() { @Test
func notMatchingDefinition() {
// Given // Given
let lines = ["section_name", let lines = ["section_name",
"[section_name]", "[section_name]",
@@ -41,12 +42,13 @@ final class SectionTests: XCTestCase {
let matches = lines.compactMap { Section.match($0) } let matches = lines.compactMap { Section.match($0) }
// Expect // Expect
XCTAssertEqual(matches.isEmpty, true) #expect(matches.isEmpty == true)
} }
// MARK: - Matching tags // MARK: - Matching tags
func testMatchingTags() { @Test
func matchingTags() {
// Given // Given
let section = Section(name: "section_name") let section = Section(name: "section_name")
section.definitions = [ section.definitions = [
@@ -69,13 +71,14 @@ final class SectionTests: XCTestCase {
let match4 = section.hasOneOrMoreMatchingTags(tags: ["droidonly"]) let match4 = section.hasOneOrMoreMatchingTags(tags: ["droidonly"])
// Expect // Expect
XCTAssertTrue(match1) #expect(match1)
XCTAssertTrue(match2) #expect(match2)
XCTAssertTrue(match3) #expect(match3)
XCTAssertTrue(match4) #expect(match4)
} }
func testNotMatchingTags() { @Test
func notMatchingTags() {
// Given // Given
let section = Section(name: "section_name") let section = Section(name: "section_name")
section.definitions = [ section.definitions = [
@@ -97,8 +100,8 @@ final class SectionTests: XCTestCase {
let match3 = section.hasOneOrMoreMatchingTags(tags: ["azerty"]) let match3 = section.hasOneOrMoreMatchingTags(tags: ["azerty"])
// Expect // Expect
XCTAssertFalse(match1) #expect(match1 == false)
XCTAssertFalse(match2) #expect(match2 == false)
XCTAssertFalse(match3) #expect(match3 == false)
} }
} }
@@ -6,16 +6,17 @@
// //
import Foundation import Foundation
import XCTest import Testing
import ToolCore import ToolCore
@testable import ResgenSwift @testable import ResgenSwift
final class StringsFileGeneratorTests: XCTestCase { struct StringsFileGeneratorTests {
// MARK: - Strings File Content // MARK: - Strings File Content
func testGenerateStringsFileContent() { @Test
func generateStringsFileContent() {
// Given // Given
let sectionOne = Section.Mock.getSectionOne() let sectionOne = Section.Mock.getSectionOne()
let sectionTwo = Section.Mock.getSectionTwo() let sectionTwo = Section.Mock.getSectionTwo()
@@ -36,17 +37,12 @@ final class StringsFileGeneratorTests: XCTestCase {
// CPD-ON // CPD-ON
// Expect // Expect
XCTAssertEqual( #expect(stringsFileContentFr.adaptForTest() == Self.appleStringsFileExpectationFr.adaptForTest())
stringsFileContentFr.adaptForXCTest(), #expect(stringsFileContentEn.adaptForTest() == Self.appleStringsFileExpectationEn.adaptForTest())
Self.appleStringsFileExpectationFr.adaptForXCTest()
)
XCTAssertEqual(
stringsFileContentEn.adaptForXCTest(),
Self.appleStringsFileExpectationEn.adaptForXCTest()
)
} }
func testGenerateStringsFileContentWithComment() { @Test
func generateStringsFileContentWithComment() {
// Given // Given
let sectionOne = Section.Mock.getSectionOne( let sectionOne = Section.Mock.getSectionOne(
defOneComment: "This is a comment", defOneComment: "This is a comment",
@@ -73,19 +69,14 @@ final class StringsFileGeneratorTests: XCTestCase {
// CPD-ON // CPD-ON
// Expect // Expect
XCTAssertEqual( #expect(stringsFileContentFr.adaptForTest() == Self.appleStringsFileExpectationFr.adaptForTest())
stringsFileContentFr.adaptForXCTest(), #expect(stringsFileContentEn.adaptForTest() == Self.appleStringsFileExpectationEn.adaptForTest())
Self.appleStringsFileExpectationFr.adaptForXCTest()
)
XCTAssertEqual(
stringsFileContentEn.adaptForXCTest(),
Self.appleStringsFileExpectationEn.adaptForXCTest()
)
} }
// MARK: - XcString File Content // MARK: - XcString File Content
func testGenerateXcStringsRootObject() { @Test
func generateXcStringsRootObject() {
// Given // Given
let sectionOne = Section.Mock.getSectionOne() let sectionOne = Section.Mock.getSectionOne()
let sectionTwo = Section.Mock.getSectionTwo( let sectionTwo = Section.Mock.getSectionTwo(
@@ -223,10 +214,11 @@ final class StringsFileGeneratorTests: XCTestCase {
version: "1.0" version: "1.0"
) )
XCTAssertEqual(rootObject, expect) #expect(rootObject == expect)
} }
func testGenerateXcStringsRootObjectWithEmptyTranslations() { @Test
func generateXcStringsRootObjectWithEmptyTranslations() {
// Given // Given
let sectionOne = Section.Mock.getSectionOne( let sectionOne = Section.Mock.getSectionOne(
defOneFr: "", defOneFr: "",
@@ -273,10 +265,11 @@ final class StringsFileGeneratorTests: XCTestCase {
version: "1.0" version: "1.0"
) )
XCTAssertEqual(rootObject, expect) #expect(rootObject == expect)
} }
func testGenerateXcStringsRootObjectWithNoTranslations() { @Test
func generateXcStringsRootObjectWithNoTranslations() {
// Given // Given
let sectionOne = Section.Mock.getSectionOne( let sectionOne = Section.Mock.getSectionOne(
defOneFr: "", defOneFr: "",
@@ -323,10 +316,11 @@ final class StringsFileGeneratorTests: XCTestCase {
version: "1.0" version: "1.0"
) )
XCTAssertEqual(rootObject, expect) #expect(rootObject == expect)
} }
func testGenerateXcStringsRootObjectWithComments() { @Test
func generateXcStringsRootObjectWithComments() {
// Given // Given
let sectionOne = Section.Mock.getSectionOne( let sectionOne = Section.Mock.getSectionOne(
defOneComment: "Comment 1", defOneComment: "Comment 1",
@@ -362,12 +356,13 @@ final class StringsFileGeneratorTests: XCTestCase {
version: "1.0" version: "1.0"
) )
XCTAssertEqual(rootObject, expect) #expect(rootObject == expect)
} }
// MARK: - Extension Content // MARK: - Extension Content
func testGeneratedExtensionContent() { @Test
func generatedExtensionContent() {
// Given // Given
let sectionOne = Section.Mock.getSectionOne() let sectionOne = Section.Mock.getSectionOne()
let sectionTwo = Section.Mock.getSectionTwo() let sectionTwo = Section.Mock.getSectionTwo()
@@ -393,10 +388,11 @@ final class StringsFileGeneratorTests: XCTestCase {
if extensionContent != expect { if extensionContent != expect {
print(prettyFirstDifferenceBetweenStrings(s1: extensionContent, s2: expect)) print(prettyFirstDifferenceBetweenStrings(s1: extensionContent, s2: expect))
} }
XCTAssertEqual(extensionContent.adaptForXCTest(), expect.adaptForXCTest()) #expect(extensionContent.adaptForTest() == expect.adaptForTest())
} }
func testGeneratedExtensionContentWithComment() { @Test
func generatedExtensionContentWithComment() {
// Given // Given
let sectionOne = Section.Mock.getSectionOne( let sectionOne = Section.Mock.getSectionOne(
defOneComment: "This is a comment", defOneComment: "This is a comment",
@@ -433,11 +429,12 @@ final class StringsFileGeneratorTests: XCTestCase {
if extensionContent != expect { if extensionContent != expect {
print(prettyFirstDifferenceBetweenStrings(s1: extensionContent, s2: expect)) print(prettyFirstDifferenceBetweenStrings(s1: extensionContent, s2: expect))
} }
XCTAssertEqual(extensionContent.adaptForXCTest(), expect.adaptForXCTest()) #expect(extensionContent.adaptForTest() == expect.adaptForTest())
} }
// MARK: - Extension Content Static // MARK: - Extension Content Static
func testGeneratedExtensionContentWithIsStatic() { @Test
func generatedExtensionContentWithIsStatic() {
// Given // Given
let sectionOne = Section.Mock.getSectionOne() let sectionOne = Section.Mock.getSectionOne()
let sectionTwo = Section.Mock.getSectionTwo() let sectionTwo = Section.Mock.getSectionTwo()
@@ -465,10 +462,11 @@ final class StringsFileGeneratorTests: XCTestCase {
if extensionContent != expect { if extensionContent != expect {
print(prettyFirstDifferenceBetweenStrings(s1: extensionContent, s2: expect)) print(prettyFirstDifferenceBetweenStrings(s1: extensionContent, s2: expect))
} }
XCTAssertEqual(extensionContent.adaptForXCTest(), expect.adaptForXCTest()) #expect(extensionContent.adaptForTest() == expect.adaptForTest())
} }
func testGeneratedExtensionContentWithIsStaticWithComment() { @Test
func generatedExtensionContentWithIsStaticWithComment() {
// Given // Given
let sectionOne = Section.Mock.getSectionOne( let sectionOne = Section.Mock.getSectionOne(
defOneComment: "This is a comment", defOneComment: "This is a comment",
@@ -506,7 +504,7 @@ final class StringsFileGeneratorTests: XCTestCase {
if extensionContent != expect { if extensionContent != expect {
print(prettyFirstDifferenceBetweenStrings(s1: extensionContent, s2: expect)) print(prettyFirstDifferenceBetweenStrings(s1: extensionContent, s2: expect))
} }
XCTAssertEqual(extensionContent.adaptForXCTest(), expect.adaptForXCTest()) #expect(extensionContent.adaptForTest() == expect.adaptForTest())
} }
} }
@@ -6,12 +6,12 @@
// //
import Foundation import Foundation
import XCTest import Testing
import ToolCore import ToolCore
@testable import ResgenSwift @testable import ResgenSwift
final class TagsGeneratorTests: XCTestCase { struct TagsGeneratorTests {
private func getDefinition( private func getDefinition(
name: String, name: String,
@@ -24,7 +24,8 @@ final class TagsGeneratorTests: XCTestCase {
return definition return definition
} }
func testGeneratedExtensionContent() { @Test
func generatedExtensionContent() {
// Given // Given
let sectionOne = Section(name: "section_one") let sectionOne = Section(name: "section_one")
sectionOne.definitions = [ sectionOne.definitions = [
@@ -94,6 +95,6 @@ final class TagsGeneratorTests: XCTestCase {
} }
""" """
XCTAssertEqual(extensionContent.adaptForXCTest(), expect.adaptForXCTest()) #expect(extensionContent.adaptForTest() == expect.adaptForTest())
} }
} }