Skip to content

Commit

Permalink
Merge branch 'master' into double-box
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxDesiatov authored Oct 6, 2019
2 parents 6b8b050 + bb6dda2 commit 73193cf
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 6 deletions.
51 changes: 51 additions & 0 deletions Tests/XMLCoderTests/QuoteDecodingTest.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
//
// QuoteDecodingTest.swift
// XMLCoderTests
//
// Created by Max Desiatov on 05/10/2019.
//

import Foundation
import XCTest
@testable import XMLCoder

private let xml =
"""
<root>
<aResponse>&lt;uesb2b:response
xmlns:uesb2b=&quot;http://services.b2b.ues.ut.uhg.com/types/plans/&quot;
xmlns=&quot;http://services.b2b.ues.ut.uhg.com/types/plans/&quot;&gt;&#xd;
&lt;uesb2b:st cd=&quot;GA&quot; /&gt;&#xd;
&lt;uesb2b:obligId val=&quot;01&quot; /&gt;&#xd;
&lt;uesb2b:shrArrangementId val=&quot;00&quot; /&gt;&#xd;
&lt;uesb2b:busInsType val=&quot;CG&quot; /&gt;&#xd;
&lt;uesb2b:metalPlans typ=&quot;Array&quot;
</aResponse>
</root>
""".data(using: .utf8)!

private let expectedResponse =
"""
<uesb2b:response
xmlns:uesb2b="http://services.b2b.ues.ut.uhg.com/types/plans/"
xmlns="http://services.b2b.ues.ut.uhg.com/types/plans/">\r
<uesb2b:st cd="GA" />\r
<uesb2b:obligId val="01" />\r
<uesb2b:shrArrangementId val="00" />\r
<uesb2b:busInsType val="CG" />\r
<uesb2b:metalPlans typ="Array"
"""

private struct Response: Decodable {
let aResponse: String
}

final class QuoteDecodingTest: XCTestCase {
func testQuoteDecoding() throws {
let decoder = XMLDecoder()
decoder.trimValueWhitespaces = false
let response = try decoder.decode(Response.self, from: xml).aResponse
XCTAssertEqual(response, expectedResponse)
}
}
16 changes: 10 additions & 6 deletions XMLCoder.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
B5F74472233F74E400BBDB15 /* RootLevelAttributeTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F74471233F74E400BBDB15 /* RootLevelAttributeTest.swift */; };
D11E094623491BCE00C24DCB /* DoubleBox.swift in Sources */ = {isa = PBXBuildFile; fileRef = D11E094523491BCE00C24DCB /* DoubleBox.swift */; };
D11E094A234924C500C24DCB /* ValueBox.swift in Sources */ = {isa = PBXBuildFile; fileRef = D11E0949234924C500C24DCB /* ValueBox.swift */; };
D18FBFB82348FAE500FA4F65 /* QuoteDecodingTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = D18FBFB72348FAE500FA4F65 /* QuoteDecodingTest.swift */; };
OBJ_148 /* BoolBox.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_12 /* BoolBox.swift */; };
OBJ_149 /* Box.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_13 /* Box.swift */; };
OBJ_150 /* ChoiceBox.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_14 /* ChoiceBox.swift */; };
Expand Down Expand Up @@ -162,6 +163,7 @@
B5F74471233F74E400BBDB15 /* RootLevelAttributeTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootLevelAttributeTest.swift; sourceTree = "<group>"; };
D11E094523491BCE00C24DCB /* DoubleBox.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DoubleBox.swift; sourceTree = "<group>"; };
D11E0949234924C500C24DCB /* ValueBox.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ValueBox.swift; sourceTree = "<group>"; };
D18FBFB72348FAE500FA4F65 /* QuoteDecodingTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuoteDecodingTest.swift; sourceTree = "<group>"; };
OBJ_100 /* DecimalTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DecimalTests.swift; sourceTree = "<group>"; };
OBJ_101 /* EmptyTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmptyTests.swift; sourceTree = "<group>"; };
OBJ_102 /* FloatTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FloatTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -425,13 +427,14 @@
OBJ_59 /* XMLCoderTests */ = {
isa = PBXGroup;
children = (
OBJ_62 /* Auxiliary */,
OBJ_71 /* Box */,
OBJ_95 /* Minimal */,
OBJ_60 /* AttributedEnumIntrinsicTest.swift */,
OBJ_61 /* AttributedIntrinsicTest.swift */,
OBJ_62 /* Auxiliary */,
OBJ_68 /* BenchmarkTests.swift */,
OBJ_69 /* BooksTest.swift */,
OBJ_70 /* BorderTest.swift */,
OBJ_71 /* Box */,
OBJ_85 /* BreakfastTest.swift */,
OBJ_86 /* CDCatalog.swift */,
OBJ_87 /* CDTest.swift */,
Expand All @@ -443,24 +446,24 @@
OBJ_92 /* DynamicNodeEncodingTest.swift */,
OBJ_93 /* ErrorContextTest.swift */,
OBJ_94 /* KeyDecodingAndEncodingStrategyTests.swift */,
OBJ_95 /* Minimal */,
OBJ_113 /* MixedContainerTest.swift */,
OBJ_114 /* NamespaceTest.swift */,
OBJ_115 /* NestedAttributeChoiceTests.swift */,
B5EA3BB4230F235C00D8D69B /* NestedChoiceArrayTest.swift */,
OBJ_116 /* NestedChoiceTests.swift */,
OBJ_117 /* NestingTests.swift */,
OBJ_118 /* NodeEncodingStrategyTests.swift */,
OBJ_119 /* NoteTest.swift */,
OBJ_120 /* PlantCatalog.swift */,
OBJ_121 /* PlantTest.swift */,
D18FBFB72348FAE500FA4F65 /* QuoteDecodingTest.swift */,
OBJ_124 /* RelationshipsTest.swift */,
OBJ_122 /* RJISample.swift */,
OBJ_123 /* RJITest.swift */,
OBJ_124 /* RelationshipsTest.swift */,
B5F74471233F74E400BBDB15 /* RootLevelAttributeTest.swift */,
OBJ_125 /* SimpleChoiceTests.swift */,
OBJ_126 /* SingleChildTests.swift */,
OBJ_127 /* SpacePreserveTest.swift */,
B5EA3BB4230F235C00D8D69B /* NestedChoiceArrayTest.swift */,
B5F74471233F74E400BBDB15 /* RootLevelAttributeTest.swift */,
);
name = XMLCoderTests;
path = Tests/XMLCoderTests;
Expand Down Expand Up @@ -695,6 +698,7 @@
OBJ_213 /* XMLHeaderTests.swift in Sources */,
OBJ_214 /* XMLKeyTests.swift in Sources */,
OBJ_215 /* XMLStackParserTests.swift in Sources */,
D18FBFB82348FAE500FA4F65 /* QuoteDecodingTest.swift in Sources */,
OBJ_216 /* BenchmarkTests.swift in Sources */,
OBJ_217 /* BooksTest.swift in Sources */,
OBJ_218 /* BorderTest.swift in Sources */,
Expand Down

0 comments on commit 73193cf

Please sign in to comment.