Skip to content

Commit d962ed8

Browse files
author
David Dunn
committed
Add ISO8601DateFormatter stub and test stub
1 parent 8e8dd9b commit d962ed8

File tree

4 files changed

+116
-0
lines changed

4 files changed

+116
-0
lines changed

Foundation.xcodeproj/project.pbxproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,8 @@
308308
61E0117F1C1B5990000037DD /* CFRunLoop.c in Sources */ = {isa = PBXBuildFile; fileRef = 5B5D88D81BBC9AD800234F36 /* CFRunLoop.c */; };
309309
61E011811C1B5998000037DD /* CFMessagePort.c in Sources */ = {isa = PBXBuildFile; fileRef = 5B5D88DC1BBC9AEC00234F36 /* CFMessagePort.c */; };
310310
61E011821C1B599A000037DD /* CFMachPort.c in Sources */ = {isa = PBXBuildFile; fileRef = 5B5D88D01BBC9AAC00234F36 /* CFMachPort.c */; };
311+
63DCE9D21EAA430100E9CB02 /* NSISO8601DateFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63DCE9D11EAA430100E9CB02 /* NSISO8601DateFormatter.swift */; };
312+
63DCE9D41EAA432400E9CB02 /* TestNSISO8601DateFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63DCE9D31EAA432400E9CB02 /* TestNSISO8601DateFormatter.swift */; };
311313
6EB768281D18C12C00D4B719 /* UUID.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6EB768271D18C12C00D4B719 /* UUID.swift */; };
312314
7900433B1CACD33E00ECCBF1 /* TestNSCompoundPredicate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 790043391CACD33E00ECCBF1 /* TestNSCompoundPredicate.swift */; };
313315
7900433C1CACD33E00ECCBF1 /* TestNSPredicate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7900433A1CACD33E00ECCBF1 /* TestNSPredicate.swift */; };
@@ -746,6 +748,8 @@
746748
61D6C9EE1C1DFE9500DEF583 /* TestNSTimer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestNSTimer.swift; sourceTree = "<group>"; };
747749
61E0117B1C1B554D000037DD /* TestNSRunLoop.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestNSRunLoop.swift; sourceTree = "<group>"; };
748750
61F8AE7C1C180FC600FB62F0 /* TestNSNotificationCenter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestNSNotificationCenter.swift; sourceTree = "<group>"; };
751+
63DCE9D11EAA430100E9CB02 /* NSISO8601DateFormatter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSISO8601DateFormatter.swift; sourceTree = "<group>"; };
752+
63DCE9D31EAA432400E9CB02 /* TestNSISO8601DateFormatter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestNSISO8601DateFormatter.swift; sourceTree = "<group>"; };
749753
6E203B8C1C1303BB003B2576 /* TestNSBundle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestNSBundle.swift; sourceTree = "<group>"; };
750754
6EB768271D18C12C00D4B719 /* UUID.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UUID.swift; sourceTree = "<group>"; };
751755
790043391CACD33E00ECCBF1 /* TestNSCompoundPredicate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestNSCompoundPredicate.swift; sourceTree = "<group>"; };
@@ -1406,6 +1410,7 @@
14061410
BDFDF0A61DFF5B3E00C04CC5 /* TestNSPersonNameComponents.swift */,
14071411
CD1C7F7C1E303B47008E331C /* TestNSError.swift */,
14081412
90E645DE1E4C89A400D0D47C /* TestNSCache.swift */,
1413+
63DCE9D31EAA432400E9CB02 /* TestNSISO8601DateFormatter.swift */,
14091414
);
14101415
name = Tests;
14111416
sourceTree = "<group>";
@@ -1501,6 +1506,7 @@
15011506
5BDC3F351BCC5DCB00ED97BB /* NSDateFormatter.swift */,
15021507
5BDC3F391BCC5DCB00ED97BB /* NSFormatter.swift */,
15031508
5B628EDE1D1C995C00CA9570 /* NSMeasurementFormatter.swift */,
1509+
63DCE9D11EAA430100E9CB02 /* NSISO8601DateFormatter.swift */,
15041510
);
15051511
name = Formatters;
15061512
sourceTree = "<group>";
@@ -1994,6 +2000,7 @@
19942000
isa = PBXSourcesBuildPhase;
19952001
buildActionMask = 2147483647;
19962002
files = (
2003+
63DCE9D21EAA430100E9CB02 /* NSISO8601DateFormatter.swift in Sources */,
19972004
5BF7AE831BCD50CD008F214A /* NSArray.swift in Sources */,
19982005
EADE0B991BD15DFF00C49C64 /* NSEnergyFormatter.swift in Sources */,
19992006
EADE0BBF1BD15E0000C49C64 /* NSURLError.swift in Sources */,
@@ -2251,6 +2258,7 @@
22512258
5B13B3281C582D4C00651CE2 /* TestNSBundle.swift in Sources */,
22522259
5B13B32A1C582D4C00651CE2 /* TestNSCharacterSet.swift in Sources */,
22532260
BF8E65311DC3B3CB005AB5C3 /* TestNotification.swift in Sources */,
2261+
63DCE9D41EAA432400E9CB02 /* TestNSISO8601DateFormatter.swift in Sources */,
22542262
EA01AAEC1DA839C4008F4E07 /* TestProgress.swift in Sources */,
22552263
5B13B3411C582D4C00651CE2 /* TestNSRegularExpression.swift in Sources */,
22562264
5B13B3491C582D4C00651CE2 /* TestNSTimeZone.swift in Sources */,
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// This source file is part of the Swift.org open source project
2+
//
3+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
4+
// Licensed under Apache License v2.0 with Runtime Library Exception
5+
//
6+
// See http://swift.org/LICENSE.txt for license information
7+
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
8+
//
9+
10+
import CoreFoundation
11+
12+
extension ISO8601DateFormatter {
13+
14+
15+
public struct Options : OptionSet {
16+
public private(set) var rawValue: UInt
17+
public init(rawValue: UInt) { self.rawValue = rawValue }
18+
19+
public static var withYear = ISO8601DateFormatter.Options(rawValue: 1 << 0)
20+
21+
public static var withMonth = ISO8601DateFormatter.Options(rawValue: 1 << 1)
22+
23+
public static var withWeekOfYear = ISO8601DateFormatter.Options(rawValue: 1 << 2)
24+
25+
public static var withDay = ISO8601DateFormatter.Options(rawValue: 1 << 3)
26+
27+
public static var withTime = ISO8601DateFormatter.Options(rawValue: 1 << 4)
28+
29+
public static var withTimeZone = ISO8601DateFormatter.Options(rawValue: 1 << 5)
30+
31+
public static var withSpaceBetweenDateAndTime = ISO8601DateFormatter.Options(rawValue: 1 << 6)
32+
33+
public static var withDashSeparatorInDate = ISO8601DateFormatter.Options(rawValue: 1 << 7)
34+
35+
public static var withColonSeparatorInTime = ISO8601DateFormatter.Options(rawValue: 1 << 8)
36+
37+
public static var withColonSeparatorInTimeZone = ISO8601DateFormatter.Options(rawValue: 1 << 9)
38+
39+
public static var withFullDate = ISO8601DateFormatter.Options(rawValue: 1 << 10)
40+
41+
public static var withFullTime = ISO8601DateFormatter.Options(rawValue: 1 << 11)
42+
43+
public static var withInternetDateTime = ISO8601DateFormatter.Options(rawValue: 1 << 12)
44+
}
45+
}
46+
47+
open class ISO8601DateFormatter : Formatter, NSSecureCoding {
48+
49+
50+
/* Please note that there can be a significant performance cost when resetting these properties. Resetting each property can result in regenerating the entire CFDateFormatterRef, which can be very expensive. */
51+
open var timeZone: TimeZone! // The default time zone is GMT.
52+
53+
54+
open var formatOptions: ISO8601DateFormatter.Options
55+
56+
57+
/* This init method creates a formatter object set to the GMT time zone and preconfigured with the RFC 3339 standard format ("yyyy-MM-dd'T'HH:mm:ssXXXXX") using the following options:
58+
NSISO8601DateFormatWithInternetDateTime | NSISO8601DateFormatWithDashSeparatorInDate | NSISO8601DateFormatWithColonSeparatorInTime | NSISO8601DateFormatWithColonSeparatorInTimeZone
59+
*/
60+
public override init() { NSUnimplemented() }
61+
62+
public required init?(coder aDecoder: NSCoder) { NSUnimplemented() }
63+
open override func encode(with aCoder: NSCoder) { NSUnimplemented() }
64+
public static var supportsSecureCoding: Bool { return true }
65+
66+
67+
open func string(from date: Date) -> String {
68+
NSUnimplemented()
69+
}
70+
71+
open func date(from string: String) -> Date? {
72+
NSUnimplemented()
73+
}
74+
75+
76+
open class func string(from date: Date, timeZone: TimeZone, formatOptions: ISO8601DateFormatter.Options = []) -> String {
77+
NSUnimplemented()
78+
}
79+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// This source file is part of the Swift.org open source project
2+
//
3+
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
4+
// Licensed under Apache License v2.0 with Runtime Library Exception
5+
//
6+
// See http://swift.org/LICENSE.txt for license information
7+
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
8+
//
9+
10+
#if DEPLOYMENT_RUNTIME_OBJC || os(Linux)
11+
import Foundation
12+
import XCTest
13+
#else
14+
import SwiftFoundation
15+
import SwiftXCTest
16+
#endif
17+
18+
class TestNSISO8601DateFormatter: XCTestCase {
19+
20+
let DEFAULT_LOCALE = "en_US"
21+
let DEFAULT_TIMEZONE = "GMT"
22+
23+
static var allTests : [(String, (TestNSISO8601DateFormatter) -> () throws -> Void)] {
24+
return [
25+
26+
]
27+
}
28+
}

TestFoundation/main.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,5 @@ XCTMain([
9393
testCase(TestProgress.allTests),
9494
testCase(TestObjCRuntime.allTests),
9595
testCase(TestNotification.allTests),
96+
testCase(TestNSISO8601DateFormatter.allTests),
9697
])

0 commit comments

Comments
 (0)