Skip to content
This repository has been archived by the owner on Aug 24, 2019. It is now read-only.

Commit

Permalink
Better writing coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
soffes committed May 27, 2015
1 parent 91dae4f commit aeb5da7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Tests/SerializationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,22 @@ class SerializationTests: XCTestCase {
XCTAssertEqual(parse("2014-03-13T10:42:12-09:30"), components(year: 2014, month: 3, day: 13, hour: 10, minute: 42, second: 12, timeZoneOffset: -9.5 * 60 * 60))
}

func testPartials() {
XCTAssertEqual(parse("2015"), components(year: 2015))
XCTAssertEqual(parse("2015-💩"), components(year: 2015))
XCTAssertEqual(parse("2015-03"), components(year: 2015, month: 3))
XCTAssertEqual(parse("2015-03-💩"), components(year: 2015, month: 3))
XCTAssertEqual(parse("2015-03-13"), components(year: 2015, month: 3, day: 13))
XCTAssertEqual(parse("2015-03-13-💩"), components(year: 2015, month: 3, day: 13))
XCTAssertEqual(parse("2015-03-13T💩"), components(year: 2015, month: 3, day: 13))
XCTAssertEqual(parse("2015-03-13T10"), components(year: 2015, month: 3, day: 13, hour: 10))
XCTAssertEqual(parse("2015-03-13T10:💩"), components(year: 2015, month: 3, day: 13, hour: 10))
XCTAssertEqual(parse("2015-03-13T10:42"), components(year: 2015, month: 3, day: 13, hour: 10, minute: 42))
XCTAssertEqual(parse("2015-03-13T10:42:💩"), components(year: 2015, month: 3, day: 13, hour: 10, minute: 42))
XCTAssertEqual(parse("2015-03-13T10:42:10"), components(year: 2015, month: 3, day: 13, hour: 10, minute: 42, second: 10))
XCTAssertEqual(parse("2015-03-13T10:42:10+💩"), components(year: 2015, month: 3, day: 13, hour: 10, minute: 42, second: 10))
}

// func testReadingWithoutSeparators() {
// XCTAssertEqual(parse("20140313"), components(year: 2014, month: 3, day: 13))
// XCTAssertEqual(parse("20140313T104212"), components(year: 2014, month: 3, day: 13, hour: 10, minute: 42, second: 12))
Expand Down

0 comments on commit aeb5da7

Please sign in to comment.