1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-08 04:20:07 +02:00

👌 Snake case for tests

This commit is contained in:
2022-10-18 14:11:55 +02:00
parent 83657fee6f
commit ea5dd3bc46
15 changed files with 50 additions and 47 deletions

View File

@ -80,7 +80,7 @@
</CommandLineArgument> </CommandLineArgument>
<CommandLineArgument <CommandLineArgument
argument = "--configuration:/tmp/pmc_working.json" argument = "--configuration:/tmp/pmc_working.json"
isEnabled = "NO"> isEnabled = "YES">
</CommandLineArgument> </CommandLineArgument>
<CommandLineArgument <CommandLineArgument
argument = "--configuration:/tmp/pmc_broken.json" argument = "--configuration:/tmp/pmc_broken.json"

View File

@ -16,7 +16,7 @@ final class StartupTest: UITestCase {
override func tearDownWithError() throws {} override func tearDownWithError() throws {}
final func testApplicationCanLaunchWithTestConfigurationAndThrowsAlert() throws { final func test_launch_halts_due_to_system_configuration_issue() throws {
var configuration = TestableConfigurations.working var configuration = TestableConfigurations.working
configuration.filesystem["/opt/homebrew/bin/php"] = nil // PHP binary must be missing configuration.filesystem["/opt/homebrew/bin/php"] = nil // PHP binary must be missing
@ -48,7 +48,7 @@ final class StartupTest: UITestCase {
app.terminate() app.terminate()
} }
final func testApplicationCanWarnAboutPhpFpmIssue() throws { final func test_get_warning_about_missing_fpm_symlink() throws {
var configuration = TestableConfigurations.working var configuration = TestableConfigurations.working
configuration.filesystem["/opt/homebrew/etc/php/8.1/php-fpm.d/valet-fpm.conf"] = nil configuration.filesystem["/opt/homebrew/etc/php/8.1/php-fpm.d/valet-fpm.conf"] = nil
@ -60,7 +60,7 @@ final class StartupTest: UITestCase {
click(app.buttons["generic.ok".localized]) click(app.buttons["generic.ok".localized])
} }
final func testPhpMonitorLaunchesCorrectlyAndIdles() throws { final func test_can_open_status_menu_item() throws {
let app = XCPMApplication() let app = XCPMApplication()
app.withConfiguration(TestableConfigurations.working) app.withConfiguration(TestableConfigurations.working)
app.launch() app.launch()

View File

@ -10,7 +10,7 @@ import XCTest
class CommandTest: XCTestCase { class CommandTest: XCTestCase {
func testDeterminePhpVersion() { func test_determine_php_version() {
let version = Command.execute( let version = Command.execute(
path: Paths.php, path: Paths.php,
arguments: ["-v"], arguments: ["-v"],

View File

@ -17,7 +17,7 @@ class HomebrewPackageTest: XCTestCase {
.url(forResource: "brew-formula", withExtension: "json")! .url(forResource: "brew-formula", withExtension: "json")!
} }
func testCanLoadExtensionJson() throws { func test_can_load_extension_json() throws {
let json = try! String(contentsOf: Self.jsonBrewFile, encoding: .utf8) let json = try! String(contentsOf: Self.jsonBrewFile, encoding: .utf8)
let package = try! JSONDecoder().decode( let package = try! JSONDecoder().decode(
[HomebrewPackage].self, from: json.data(using: .utf8)! [HomebrewPackage].self, from: json.data(using: .utf8)!
@ -36,7 +36,7 @@ class HomebrewPackageTest: XCTestCase {
.url(forResource: "brew-services", withExtension: "json")! .url(forResource: "brew-services", withExtension: "json")!
} }
func testCanParseServicesJson() throws { func test_can_parse_services_json() throws {
let json = try! String(contentsOf: Self.jsonBrewServicesFile, encoding: .utf8) let json = try! String(contentsOf: Self.jsonBrewServicesFile, encoding: .utf8)
let services = try! JSONDecoder().decode( let services = try! JSONDecoder().decode(
[HomebrewService].self, from: json.data(using: .utf8)! [HomebrewService].self, from: json.data(using: .utf8)!
@ -49,11 +49,12 @@ class HomebrewPackageTest: XCTestCase {
// - MARK: LIVE TESTS // - MARK: LIVE TESTS
/// TODO: Use fake data or make this an integration test
/// This test requires that you have a valid Homebrew installation set up, /// This test requires that you have a valid Homebrew installation set up,
/// and requires the Valet services to be installed: php, nginx and dnsmasq. /// and requires the Valet services to be installed: php, nginx and dnsmasq.
/// If this test fails, there is an issue with your Homebrew installation /// If this test fails, there is an issue with your Homebrew installation
/// or the JSON API of the Homebrew output may have changed. /// or the JSON API of the Homebrew output may have changed.
func testCanParseServicesJsonFromCliOutput() async throws { func test_can_parse_services_json_from_cli_output() async throws {
ActiveShell.useSystem() ActiveShell.useSystem()
let services = try! JSONDecoder().decode( let services = try! JSONDecoder().decode(
@ -71,11 +72,12 @@ class HomebrewPackageTest: XCTestCase {
XCTAssertEqual(services.count, 3) XCTAssertEqual(services.count, 3)
} }
/// TODO: Use fake data or make this an integration test
/// This test requires that you have a valid Homebrew installation set up, /// This test requires that you have a valid Homebrew installation set up,
/// and requires the `php` formula to be installed. /// and requires the `php` formula to be installed.
/// If this test fails, there is an issue with your Homebrew installation /// If this test fails, there is an issue with your Homebrew installation
/// or the JSON API of the Homebrew output may have changed. /// or the JSON API of the Homebrew output may have changed.
func testCanLoadExtensionJsonFromCliOutput() async throws { func test_can_load_extension_json_from_cli_output() async throws {
ActiveShell.useSystem() ActiveShell.useSystem()
let package = try! JSONDecoder().decode( let package = try! JSONDecoder().decode(

View File

@ -34,7 +34,7 @@ class NginxConfigurationTest: XCTestCase {
// MARK: - Tests // MARK: - Tests
func testCanDetermineSiteNameAndTld() throws { func test_can_determine_site_name_and_tld() throws {
XCTAssertEqual( XCTAssertEqual(
"nginx-site", "nginx-site",
NginxConfigurationFile.from(filePath: NginxConfigurationTest.regularUrl.path)?.domain NginxConfigurationFile.from(filePath: NginxConfigurationTest.regularUrl.path)?.domain
@ -45,7 +45,7 @@ class NginxConfigurationTest: XCTestCase {
) )
} }
func testCanDetermineIsolation() throws { func test_can_determine_isolation() throws {
XCTAssertNil( XCTAssertNil(
NginxConfigurationFile.from(filePath: NginxConfigurationTest.regularUrl.path)?.isolatedVersion NginxConfigurationFile.from(filePath: NginxConfigurationTest.regularUrl.path)?.isolatedVersion
) )
@ -56,7 +56,7 @@ class NginxConfigurationTest: XCTestCase {
) )
} }
func testCanDetermineProxy() throws { func test_can_determine_proxy() throws {
let proxied = NginxConfigurationFile.from(filePath: NginxConfigurationTest.proxyUrl.path)! let proxied = NginxConfigurationFile.from(filePath: NginxConfigurationTest.proxyUrl.path)!
XCTAssertTrue(proxied.contents.contains("# valet stub: proxy.valet.conf")) XCTAssertTrue(proxied.contents.contains("# valet stub: proxy.valet.conf"))
XCTAssertEqual("http://127.0.0.1:90", proxied.proxy) XCTAssertEqual("http://127.0.0.1:90", proxied.proxy)
@ -66,13 +66,13 @@ class NginxConfigurationTest: XCTestCase {
XCTAssertEqual(nil, normal.proxy) XCTAssertEqual(nil, normal.proxy)
} }
func testCanDetermineSecuredProxy() throws { func test_can_determine_secured_proxy() throws {
let proxied = NginxConfigurationFile.from(filePath: NginxConfigurationTest.secureProxyUrl.path)! let proxied = NginxConfigurationFile.from(filePath: NginxConfigurationTest.secureProxyUrl.path)!
XCTAssertTrue(proxied.contents.contains("# valet stub: secure.proxy.valet.conf")) XCTAssertTrue(proxied.contents.contains("# valet stub: secure.proxy.valet.conf"))
XCTAssertEqual("http://127.0.0.1:90", proxied.proxy) XCTAssertEqual("http://127.0.0.1:90", proxied.proxy)
} }
func testCanDetermineProxyWithCustomTld() throws { func test_can_determine_proxy_with_custom_tld() throws {
let proxied = NginxConfigurationFile.from(filePath: NginxConfigurationTest.customTldProxyUrl.path)! let proxied = NginxConfigurationFile.from(filePath: NginxConfigurationTest.customTldProxyUrl.path)!
XCTAssertTrue(proxied.contents.contains("# valet stub: secure.proxy.valet.conf")) XCTAssertTrue(proxied.contents.contains("# valet stub: secure.proxy.valet.conf"))
XCTAssertEqual("http://localhost:8080", proxied.proxy) XCTAssertEqual("http://localhost:8080", proxied.proxy)

View File

@ -14,7 +14,7 @@ class PhpConfigurationTest: XCTestCase {
return Bundle(for: Self.self).url(forResource: "php", withExtension: "ini")! return Bundle(for: Self.self).url(forResource: "php", withExtension: "ini")!
} }
func testCanLoadExtension() throws { func test_can_load_extension() throws {
let iniFile = PhpConfigurationFile.from(filePath: Self.phpIniFileUrl.path)! let iniFile = PhpConfigurationFile.from(filePath: Self.phpIniFileUrl.path)!
XCTAssertNotNil(iniFile) XCTAssertNotNil(iniFile)
@ -22,7 +22,7 @@ class PhpConfigurationTest: XCTestCase {
XCTAssertGreaterThan(iniFile.extensions.count, 0) XCTAssertGreaterThan(iniFile.extensions.count, 0)
} }
func testCanCheckKeyExistence() throws { func test_can_check_key_existence() throws {
let iniFile = PhpConfigurationFile.from(filePath: Self.phpIniFileUrl.path)! let iniFile = PhpConfigurationFile.from(filePath: Self.phpIniFileUrl.path)!
XCTAssertTrue(iniFile.has(key: "error_reporting")) XCTAssertTrue(iniFile.has(key: "error_reporting"))
@ -30,7 +30,7 @@ class PhpConfigurationTest: XCTestCase {
XCTAssertFalse(iniFile.has(key: "my_unknown_key")) XCTAssertFalse(iniFile.has(key: "my_unknown_key"))
} }
func testCanCheckKeyValue() throws { func test_can_check_key_value() throws {
let iniFile = PhpConfigurationFile.from(filePath: Self.phpIniFileUrl.path)! let iniFile = PhpConfigurationFile.from(filePath: Self.phpIniFileUrl.path)!
XCTAssertNotNil(iniFile.get(for: "error_reporting")) XCTAssertNotNil(iniFile.get(for: "error_reporting"))
@ -40,7 +40,7 @@ class PhpConfigurationTest: XCTestCase {
XCTAssert(iniFile.get(for: "display_errors") == "On") XCTAssert(iniFile.get(for: "display_errors") == "On")
} }
func testCanCustomizeConfigurationValue() throws { func test_can_customize_configuration_value() throws {
let destination = Utility let destination = Utility
.copyToTemporaryFile(resourceName: "php", fileExtension: "ini")! .copyToTemporaryFile(resourceName: "php", fileExtension: "ini")!

View File

@ -14,13 +14,13 @@ class PhpExtensionTest: XCTestCase {
return Bundle(for: Self.self).url(forResource: "php", withExtension: "ini")! return Bundle(for: Self.self).url(forResource: "php", withExtension: "ini")!
} }
func testCanLoadExtension() throws { func test_can_load_extension() throws {
let extensions = PhpExtension.from(filePath: Self.phpIniFileUrl.path) let extensions = PhpExtension.from(filePath: Self.phpIniFileUrl.path)
XCTAssertGreaterThan(extensions.count, 0) XCTAssertGreaterThan(extensions.count, 0)
} }
func testExtensionNameIsCorrect() throws { func test_extension_name_is_correct() throws {
let extensions = PhpExtension.from(filePath: Self.phpIniFileUrl.path) let extensions = PhpExtension.from(filePath: Self.phpIniFileUrl.path)
let extensionNames = extensions.map { (ext) -> String in let extensionNames = extensions.map { (ext) -> String in
@ -39,7 +39,7 @@ class PhpExtensionTest: XCTestCase {
XCTAssertFalse(extensionNames.contains("nice")) XCTAssertFalse(extensionNames.contains("nice"))
} }
func testExtensionStatusIsCorrect() throws { func test_extension_status_is_correct() throws {
let extensions = PhpExtension.from(filePath: Self.phpIniFileUrl.path) let extensions = PhpExtension.from(filePath: Self.phpIniFileUrl.path)
// xdebug should be enabled // xdebug should be enabled
@ -49,7 +49,7 @@ class PhpExtensionTest: XCTestCase {
XCTAssertEqual(extensions[1].enabled, false) XCTAssertEqual(extensions[1].enabled, false)
} }
func testToggleWorksAsExpected() async throws { func test_toggle_works_as_expected() async throws {
let destination = Utility.copyToTemporaryFile(resourceName: "php", fileExtension: "ini")! let destination = Utility.copyToTemporaryFile(resourceName: "php", fileExtension: "ini")!
let extensions = PhpExtension.from(filePath: destination.path) let extensions = PhpExtension.from(filePath: destination.path)
XCTAssertEqual(extensions.count, 6) XCTAssertEqual(extensions.count, 6)

View File

@ -17,7 +17,7 @@ class ValetConfigurationTest: XCTestCase {
)! )!
} }
func testCanLoadConfigFile() throws { func test_can_load_config_file() throws {
let json = try? String( let json = try? String(
contentsOf: Self.jsonConfigFileUrl, contentsOf: Self.jsonConfigFileUrl,
encoding: .utf8 encoding: .utf8

View File

@ -12,8 +12,9 @@ class TestableConfigurationTest: XCTestCase {
func test_configuration_can_be_saved_as_json() async { func test_configuration_can_be_saved_as_json() async {
var configuration = TestableConfigurations.working var configuration = TestableConfigurations.working
configuration.filesystem["/opt/homebrew/bin/php"] = nil configuration.filesystem["/opt/homebrew/bin/php"] = nil
print(configuration.filesystem.keys)
let json = configuration.toJson() let json = configuration.toJson()
try! json.write(toFile: "/tmp/pmc_working.json", atomically: true, encoding: .utf8) try! json.write(toFile: "/tmp/pmc_working.json", atomically: true, encoding: .utf8)
try! json.write(toFile: "/tmp/pmc_broken.json", atomically: true, encoding: .utf8) try! json.write(toFile: "/tmp/pmc_broken.json", atomically: true, encoding: .utf8)
} }

View File

@ -10,7 +10,7 @@ import XCTest
class AppUpdaterCheckTest: XCTestCase { class AppUpdaterCheckTest: XCTestCase {
func testCanRetrieveVersionFromCask() async { func test_can_retrieve_version_from_cask() async {
let caskVersion = await AppUpdateChecker.retrieveVersionFromCask() let caskVersion = await AppUpdateChecker.retrieveVersionFromCask()
let version = VersionExtractor.from(caskVersion) let version = VersionExtractor.from(caskVersion)
@ -18,21 +18,21 @@ class AppUpdaterCheckTest: XCTestCase {
XCTAssertNotNil(version) XCTAssertNotNil(version)
} }
func testTaggedReleaseOmitsZeroPatch() { func test_tagged_release_omits_zero_patch() {
let version = AppVersion.from("3.5.0_333")! let version = AppVersion.from("3.5.0_333")!
XCTAssertEqual(version.tagged, "3.5") XCTAssertEqual(version.tagged, "3.5")
XCTAssertEqual(version.version, "3.5.0") XCTAssertEqual(version.version, "3.5.0")
} }
func testTaggedReleaseDoesntOmitNonZeroPatch() { func test_tagged_release_doesnt_omit_non_zero_patch() {
let version = AppVersion.from("3.5.1_333")! let version = AppVersion.from("3.5.1_333")!
XCTAssertEqual(version.tagged, "3.5.1") XCTAssertEqual(version.tagged, "3.5.1")
XCTAssertEqual(version.version, "3.5.1") XCTAssertEqual(version.version, "3.5.1")
} }
func testTagTruncationDoesntAffectMajorVersions() { func test_tag_truncation_does_not_affect_major_versions() {
var version = AppVersion.from("5.0_333")! var version = AppVersion.from("5.0_333")!
XCTAssertEqual(version.tagged, "5.0") XCTAssertEqual(version.tagged, "5.0")

View File

@ -10,11 +10,11 @@ import XCTest
class AppVersionTest: XCTestCase { class AppVersionTest: XCTestCase {
func testCanRetrieveInternalAppVersion() { func test_can_retrieve_internal_app_version() {
XCTAssertNotNil(AppVersion.fromCurrentVersion()) XCTAssertNotNil(AppVersion.fromCurrentVersion())
} }
func testCanParseNormalVersionString() { func test_can_parse_normal_version_string() {
let version = AppVersion.from("1.0.0") let version = AppVersion.from("1.0.0")
XCTAssertNotNil(version) XCTAssertNotNil(version)
@ -23,7 +23,7 @@ class AppVersionTest: XCTestCase {
XCTAssertEqual(nil, version?.suffix) XCTAssertEqual(nil, version?.suffix)
} }
func testCanParseCaskVersionString() { func test_can_parse_cask_version_string() {
let version = AppVersion.from("1.0.0_600") let version = AppVersion.from("1.0.0_600")
XCTAssertNotNil(version) XCTAssertNotNil(version)
@ -32,7 +32,7 @@ class AppVersionTest: XCTestCase {
XCTAssertEqual(nil, version?.suffix) XCTAssertEqual(nil, version?.suffix)
} }
func testCanParseDevVersionStringWithoutBuildNumber() { func test_can_parse_dev_version_string_without_build_number() {
let version = AppVersion.from("1.0.0-dev") let version = AppVersion.from("1.0.0-dev")
XCTAssertNotNil(version) XCTAssertNotNil(version)
@ -41,7 +41,7 @@ class AppVersionTest: XCTestCase {
XCTAssertEqual("dev", version?.suffix) XCTAssertEqual("dev", version?.suffix)
} }
func testCanParseDevVersionStringWithBuildNumber() { func test_can_parse_dev_version_string_with_build_number() {
let version = AppVersion.from("1.0.0-dev,870") let version = AppVersion.from("1.0.0-dev,870")
XCTAssertNotNil(version) XCTAssertNotNil(version)
@ -50,7 +50,7 @@ class AppVersionTest: XCTestCase {
XCTAssertEqual("dev", version?.suffix) XCTAssertEqual("dev", version?.suffix)
} }
func testCanParseUnderscoresAsBuildSeparatorToo() { func test_can_parse_underscores_as_build_separator() {
let version = AppVersion.from("1.0.0-dev_870") let version = AppVersion.from("1.0.0-dev_870")
XCTAssertNotNil(version) XCTAssertNotNil(version)

View File

@ -10,7 +10,7 @@ import XCTest
class PhpVersionDetectionTest: XCTestCase { class PhpVersionDetectionTest: XCTestCase {
func testCanDetectValidPhpVersions() async throws { func test_can_detect_valid_php_versions() async throws {
let outcome = await PhpEnv.shared.extractPhpVersions(from: [ let outcome = await PhpEnv.shared.extractPhpVersions(from: [
"", // empty lines should be omitted "", // empty lines should be omitted
"php@8.0", "php@8.0",

View File

@ -11,7 +11,7 @@ import XCTest
// swiftlint:disable type_body_length // swiftlint:disable type_body_length
class PhpVersionNumberTest: XCTestCase { class PhpVersionNumberTest: XCTestCase {
func testCanDeconstructPhpVersion() throws { func test_can_deconstruct_php_version() throws {
XCTAssertEqual( XCTAssertEqual(
try! PhpVersionNumber.parse("PHP 8.2.0-dev"), try! PhpVersionNumber.parse("PHP 8.2.0-dev"),
PhpVersionNumber(major: 8, minor: 2, patch: 0) PhpVersionNumber(major: 8, minor: 2, patch: 0)
@ -38,13 +38,13 @@ class PhpVersionNumberTest: XCTestCase {
) )
} }
func testPhpVersionNumberParse() throws { func test_php_version_number_parse() throws {
XCTAssertThrowsError(try PhpVersionNumber.parse("OOF")) { error in XCTAssertThrowsError(try PhpVersionNumber.parse("OOF")) { error in
XCTAssertTrue(error is VersionParseError) XCTAssertTrue(error is VersionParseError)
} }
} }
func testCanCheckFixedConstraints() throws { func test_can_check_fixed_constraints() throws {
XCTAssertEqual( XCTAssertEqual(
PhpVersionNumberCollection PhpVersionNumberCollection
.make(from: ["7.4", "7.3", "7.2", "7.1", "7.0"]) .make(from: ["7.4", "7.3", "7.2", "7.1", "7.0"])
@ -78,7 +78,7 @@ class PhpVersionNumberTest: XCTestCase {
) )
} }
func testCanCheckCaretConstraints() throws { func test_can_check_caret_constraints() throws {
// 1. Imprecise checks // 1. Imprecise checks
XCTAssertEqual( XCTAssertEqual(
PhpVersionNumberCollection PhpVersionNumberCollection
@ -138,7 +138,7 @@ class PhpVersionNumberTest: XCTestCase {
) )
} }
func testCanCheckTildeConstraints() throws { func test_can_check_tilde_constraints() throws {
// 1. Imprecise checks // 1. Imprecise checks
XCTAssertEqual( XCTAssertEqual(
PhpVersionNumberCollection PhpVersionNumberCollection
@ -207,7 +207,7 @@ class PhpVersionNumberTest: XCTestCase {
) )
} }
func testCanCheckGreaterThanOrEqualConstraints() throws { func test_can_check_greater_than_or_equal_constraints() throws {
XCTAssertEqual( XCTAssertEqual(
PhpVersionNumberCollection PhpVersionNumberCollection
.make(from: ["7.4", "7.3", "7.2", "7.1", "7.0"]) .make(from: ["7.4", "7.3", "7.2", "7.1", "7.0"])
@ -243,7 +243,7 @@ class PhpVersionNumberTest: XCTestCase {
) )
} }
func testCanCheckGreaterThanConstraints() throws { func test_can_check_greater_than_constraints() throws {
XCTAssertEqual( XCTAssertEqual(
PhpVersionNumberCollection PhpVersionNumberCollection
.make(from: ["7.4", "7.3", "7.2", "7.1", "7.0"]) .make(from: ["7.4", "7.3", "7.2", "7.1", "7.0"])
@ -289,7 +289,7 @@ class PhpVersionNumberTest: XCTestCase {
) )
} }
func testCanCheckLessThanOrEqualConstraints() throws { func test_can_check_less_than_or_equal_constraints() throws {
XCTAssertEqual( XCTAssertEqual(
PhpVersionNumberCollection PhpVersionNumberCollection
.make(from: ["7.4", "7.3", "7.2", "7.1", "7.0"]) .make(from: ["7.4", "7.3", "7.2", "7.1", "7.0"])
@ -325,7 +325,7 @@ class PhpVersionNumberTest: XCTestCase {
) )
} }
func testCanCheckLessThanConstraints() throws { func test_can_check_less_than_constraints() throws {
XCTAssertEqual( XCTAssertEqual(
PhpVersionNumberCollection PhpVersionNumberCollection
.make(from: ["7.4", "7.3", "7.2", "7.1", "7.0"]) .make(from: ["7.4", "7.3", "7.2", "7.1", "7.0"])

View File

@ -10,7 +10,7 @@ import XCTest
class ValetVersionExtractorTest: XCTestCase { class ValetVersionExtractorTest: XCTestCase {
func testDetermineValetVersion() async { func test_can_determine_valet_version() async {
let version = await valet("--version", sudo: false) let version = await valet("--version", sudo: false)
XCTAssert(version.contains("Laravel Valet 2") || version.contains("Laravel Valet 3")) XCTAssert(version.contains("Laravel Valet 2") || version.contains("Laravel Valet 3"))
} }

View File

@ -10,12 +10,12 @@ import XCTest
class VersionExtractorTest: XCTestCase { class VersionExtractorTest: XCTestCase {
func testExtractVersion() { func test_extract_version() {
XCTAssertEqual(VersionExtractor.from("Laravel Valet 2.17.1"), "2.17.1") XCTAssertEqual(VersionExtractor.from("Laravel Valet 2.17.1"), "2.17.1")
XCTAssertEqual(VersionExtractor.from("Laravel Valet 2.0"), "2.0") XCTAssertEqual(VersionExtractor.from("Laravel Valet 2.0"), "2.0")
} }
func testVersionComparison() { func test_version_comparison() {
XCTAssertEqual("2.0".versionCompare("2.1"), .orderedAscending) XCTAssertEqual("2.0".versionCompare("2.1"), .orderedAscending)
XCTAssertEqual("2.1".versionCompare("2.0"), .orderedDescending) XCTAssertEqual("2.1".versionCompare("2.0"), .orderedDescending)
XCTAssertEqual("2.0".versionCompare("2.0"), .orderedSame) XCTAssertEqual("2.0".versionCompare("2.0"), .orderedSame)