Bruno Coelho 5cc5fbe76a New generator swift5 (#4086)
* [swift5] introduce new generator

* [swift5] add Swift Package Manager integration and update dependencies

* [swift5] run petstore

* [swift] update Swift 5 generator with Swift 4 changes

* [swift] update Swift 5 generator with Swift 4 changes

* [swift] make CodableHelper more customizable

* [swift] update pet projects

* [swift] update pet projects

* [swift] add nullable support

* [swift] make enums conform to CaseIterable

* [swift] date formatter add support for ISO8601 with and without milliseconds

* [swift] add urlsession support

* [swift] remove unecessary sample unwrapRequired

* [swift] rename JSONEncodableEncoding.swift to JSONDataEncoding.swift

* [swift] use result in generator internals

* [swift] cocoapods remove deprecated docset_url and add watchos deployment target

* [swift] Add ability to pass in a dedicated queue for processing network response (Fix for 230)

* [swift] update pet projects

* [swift] update docs

* [swift] add support for combine

* [swift] update docs

* [swift] update windows bat scripts

* [swift] update windows bat scripts

* [swift] update swift pet project tests

* [swift] update depencies

* [swift] make urlsession the default http client

* [swift] add urlsession sample project

* [swift] add urlsession sample project

* [swift] update docs

* [swift] improve combine unit tests

* [swift] update docs
2020-01-02 20:21:45 +08:00

36 lines
1.2 KiB
Swift

//
// TestClientAppTests.swift
// TestClientAppTests
//
// Created by Eric Hyche on 7/18/17.
// Copyright © 2017 Swagger Codegen. All rights reserved.
//
import XCTest
import TestClient
@testable import TestClientApp
class TestClientAppTests: XCTestCase {
func testWhenVariableNameIsDifferentFromPropertyName() throws {
// This tests to make sure that the swift4 language can handle when
// we have property names which map to variable names that are not the same.
// This can happen when we have things like snake_case property names,
// or when we have property names which may be Swift 4 reserved words.
let jsonData = """
{
"example_name": "Test example name",
"for": "Some reason",
"normalName": "Some normal name value"
}
""".data(using: .utf8)!
let decodedResult = CodableHelper.decode(VariableNameTest.self, from: jsonData)
let variableNameTest = try decodedResult.get()
XCTAssertTrue(variableNameTest.exampleName == "Test example name", "Did not decode snake_case property correctly.")
XCTAssertTrue(variableNameTest._for == "Some reason", "Did not decode property name that is a reserved word correctly.")
}
}