Skip to content

Commit

Permalink
Fix indentation mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
sketch204 committed May 10, 2024
1 parent 354ae70 commit 756330f
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 61 deletions.
14 changes: 7 additions & 7 deletions Sources/TOMLKit/Decoder/UnkeyedDecodingContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ extension InternalTOMLDecoder.UDC {
strictDecoding: self.strictDecoding,
notDecodedKeys: self.notDecodedKeys
)
let decodable = try T(from: decoder)
self.currentIndex += 1
return decodable
let decodable = try T(from: decoder)
self.currentIndex += 1
return decodable
}
}

Expand Down Expand Up @@ -198,8 +198,8 @@ extension InternalTOMLDecoder.UDC {
notDecodedKeys: self.notDecodedKeys
)
)
self.currentIndex += 1
return container
self.currentIndex += 1
return container
}

func nestedUnkeyedContainer() throws -> UnkeyedDecodingContainer {
Expand All @@ -222,8 +222,8 @@ extension InternalTOMLDecoder.UDC {
strictDecoding: self.strictDecoding,
notDecodedKeys: self.notDecodedKeys
)
self.currentIndex += 1
return container
self.currentIndex += 1
return container
}

func superDecoder() throws -> Decoder {
Expand Down
108 changes: 54 additions & 54 deletions Tests/TOMLKitTests/TOMLKitTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -447,58 +447,58 @@ final class TOMLKitTests: XCTestCase {
XCTFail("DecodingError did not occur.")
}
}
func testFailingToDecodingDateFromUDCShouldNotIncreaseIndex() throws {
let udc = InternalTOMLDecoder.UDC(
["Not a date"],
codingPath: [],
userInfo: [:],
dataDecoder: { $0.string != nil ? Data(base64Encoded: $0.string!) : nil },
strictDecoding: false,
notDecodedKeys: InternalTOMLDecoder.NotDecodedKeys()
)
XCTAssertThrowsError(try udc.decode(Date.self))
XCTAssertEqual(udc.currentIndex, 0)
}
func testDecodingObjectFromUDCShouldIncreaseIndex() throws {
struct StringCodingKey: CodingKey, Equatable {
var stringValue: String
init(stringValue: String) {
self.stringValue = stringValue
}
var intValue: Int? { nil }
init?(intValue: Int) { nil }
}

let udc = InternalTOMLDecoder.UDC(
[TOMLTable(["key": "value"], inline: false)],
codingPath: [],
userInfo: [:],
dataDecoder: { $0.string != nil ? Data(base64Encoded: $0.string!) : nil },
strictDecoding: false,
notDecodedKeys: InternalTOMLDecoder.NotDecodedKeys()
)
let _ = try udc.nestedContainer(keyedBy: StringCodingKey.self)
XCTAssertEqual(udc.currentIndex, 1)
}
func testDecodingArrayFromUDCShouldIncreaseIndex() throws {
let udc = InternalTOMLDecoder.UDC(
[["value"]],
codingPath: [],
userInfo: [:],
dataDecoder: { $0.string != nil ? Data(base64Encoded: $0.string!) : nil },
strictDecoding: false,
notDecodedKeys: InternalTOMLDecoder.NotDecodedKeys()
)
let _ = try udc.nestedUnkeyedContainer()
XCTAssertEqual(udc.currentIndex, 1)
}
func testFailingToDecodingDateFromUDCShouldNotIncreaseIndex() throws {
let udc = InternalTOMLDecoder.UDC(
["Not a date"],
codingPath: [],
userInfo: [:],
dataDecoder: { $0.string != nil ? Data(base64Encoded: $0.string!) : nil },
strictDecoding: false,
notDecodedKeys: InternalTOMLDecoder.NotDecodedKeys()
)
XCTAssertThrowsError(try udc.decode(Date.self))
XCTAssertEqual(udc.currentIndex, 0)
}
func testDecodingObjectFromUDCShouldIncreaseIndex() throws {
struct StringCodingKey: CodingKey, Equatable {
var stringValue: String
init(stringValue: String) {
self.stringValue = stringValue
}
var intValue: Int? { nil }
init?(intValue: Int) { nil }
}
let udc = InternalTOMLDecoder.UDC(
[TOMLTable(["key": "value"], inline: false)],
codingPath: [],
userInfo: [:],
dataDecoder: { $0.string != nil ? Data(base64Encoded: $0.string!) : nil },
strictDecoding: false,
notDecodedKeys: InternalTOMLDecoder.NotDecodedKeys()
)
let _ = try udc.nestedContainer(keyedBy: StringCodingKey.self)
XCTAssertEqual(udc.currentIndex, 1)
}
func testDecodingArrayFromUDCShouldIncreaseIndex() throws {
let udc = InternalTOMLDecoder.UDC(
[["value"]],
codingPath: [],
userInfo: [:],
dataDecoder: { $0.string != nil ? Data(base64Encoded: $0.string!) : nil },
strictDecoding: false,
notDecodedKeys: InternalTOMLDecoder.NotDecodedKeys()
)
let _ = try udc.nestedUnkeyedContainer()
XCTAssertEqual(udc.currentIndex, 1)
}
}

0 comments on commit 756330f

Please sign in to comment.