From 118dc911ffc3e1968ae4b53c60eb7c6fa23d5261 Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Sat, 6 May 2023 22:36:17 +0200 Subject: [PATCH] Updated documentation for the "gmt" property in the TimeZone+Zone extension and added test case scenario. --- Sources/Core/Extensions/TimeZone+Zone.swift | 2 +- .../Cases/Extensions/TimeZone+ZoneTests.swift | 34 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 Tests/Core/Cases/Extensions/TimeZone+ZoneTests.swift diff --git a/Sources/Core/Extensions/TimeZone+Zone.swift b/Sources/Core/Extensions/TimeZone+Zone.swift index e7a524b..c9152c7 100644 --- a/Sources/Core/Extensions/TimeZone+Zone.swift +++ b/Sources/Core/Extensions/TimeZone+Zone.swift @@ -4,7 +4,7 @@ public extension TimeZone { // MARK: Zones - /// Greenwich Mean Time or UTC+0 + /// A time zone indicating it is Greenwich Mean Time or UTC+0 static let gmt = TimeZone(secondsFromGMT: 0) } diff --git a/Tests/Core/Cases/Extensions/TimeZone+ZoneTests.swift b/Tests/Core/Cases/Extensions/TimeZone+ZoneTests.swift new file mode 100644 index 0000000..0bfcd34 --- /dev/null +++ b/Tests/Core/Cases/Extensions/TimeZone+ZoneTests.swift @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the SwiftLibs open source project +// +// Copyright (c) 2023 Röck+Cöde VoF. and the SwiftLibs project authors +// Licensed under the EUPL 1.2 or later. +// +// See LICENSE.txt for license information +// See CONTRIBUTORS.txt for the list of SwiftLibs project authors +// +//===----------------------------------------------------------------------===// + +import Core +import XCTest + +final class TimeZone_ZoneTests: XCTestCase { + + // MARK: Properties + + private var timeZone: TimeZone! + + // MARK: Tests + + func test_gmt() { + // GIVEN + // WHEN + timeZone = .gmt + + // THEN + XCTAssertEqual(timeZone.identifier, "GMT") + XCTAssertEqual(timeZone.secondsFromGMT(), 0) + } + +}