// // ImageFileParserTests.swift // // // Created by Thibaut Schmitt on 05/09/2022. // import Foundation import Testing @testable import ResgenSwift struct ImageFileParserTests { @Test func parseImagesFile() throws { // Given let input = """ # # SMAAS Support # id image_one 25 ? png di image_two ? 50 webp png d image_three 25 ? d image_four 75 ? """ .components(separatedBy: CharacterSet.newlines) // When let parsedImages = ImageFileParser.parseLines(input, platform: PlatormTag.ios) // Expect #expect(parsedImages.count == 2) let firstImage = try #require(parsedImages.first { $0.name == "image_one" }) #expect(firstImage.name == "image_one") #expect(firstImage.tags == "id") #expect(firstImage.width == 25) #expect(firstImage.height == -1) #expect(firstImage.imageExtensions == [.png]) let secondImage = try #require(parsedImages.first { $0.name == "image_two" }) #expect(secondImage.name == "image_two") #expect(secondImage.tags == "di") #expect(secondImage.width == -1) #expect(secondImage.height == 50) #expect(firstImage.imageExtensions == [.png]) } }