From d38be110ad551b4a1e368afa2d6a0b1ad3d7f108 Mon Sep 17 00:00:00 2001 From: Bassam Khouri Date: Thu, 16 Jul 2026 14:08:47 -0400 Subject: [PATCH] Migrate `ArgumentParserToolInfoTests` to Swift Testing Migrate all tests in target `ArgumentParserToolInfoTests` from XCTest to Swift Testing. Related to #710 --- .../ArgumentParserToolInfoTests.swift | 32 ++++++++----------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/Tests/ArgumentParserToolInfoTests/ArgumentParserToolInfoTests.swift b/Tests/ArgumentParserToolInfoTests/ArgumentParserToolInfoTests.swift index abad25650..8089e71f9 100644 --- a/Tests/ArgumentParserToolInfoTests/ArgumentParserToolInfoTests.swift +++ b/Tests/ArgumentParserToolInfoTests/ArgumentParserToolInfoTests.swift @@ -2,7 +2,7 @@ // // This source file is part of the Swift Argument Parser open source project // -// Copyright (c) 2025 Apple Inc. and the Swift project authors +// Copyright (c) 2025-2026 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information @@ -11,7 +11,7 @@ import ArgumentParserToolInfo import Foundation -import XCTest +import Testing extension DecodingError: Swift.CustomStringConvertible { public var description: String { @@ -61,22 +61,18 @@ extension FileManager { } } -final class ArgumentParserToolInfoTests: XCTestCase { - func test_examples() { - let examplesDirectory = URL(fileURLWithPath: #filePath) - .deletingLastPathComponent() - .appendingPathComponent("Examples") - let examples = FileManager.default.files( - inDirectory: examplesDirectory, - withPathExtension: "json") +@Suite struct ArgumentParserToolInfoTests { + static let examplesDirectory = URL(fileURLWithPath: #filePath) + .deletingLastPathComponent() + .appendingPathComponent("Examples") - for example in examples { - do { - let data = try Data(contentsOf: example) - _ = try JSONDecoder().decode(ToolInfoV0.self, from: data) - } catch { - XCTFail("Failed to parse \(example.path): \(error)") - } - } + static let examples: [URL] = FileManager.default.files( + inDirectory: Self.examplesDirectory, + withPathExtension: "json") + + @Test(arguments: examples) + func example(url: URL) throws { + let data = try Data(contentsOf: url) + _ = try JSONDecoder().decode(ToolInfoV0.self, from: data) } }