Skip to content

Commit

Permalink
Add unit test for HTML encoding.
Browse files Browse the repository at this point in the history
  • Loading branch information
David Steppenbeck committed Mar 16, 2020
1 parent fbd6344 commit 94c0f4b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Diagnostics.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

/* Begin PBXBuildFile section */
416CE0182406D85F00698E0A /* HTMLEncoding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 416CE0172406D85F00698E0A /* HTMLEncoding.swift */; };
416CE0D0241FA65700698E0A /* HTMLEncodingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 416CE0CF241FA65700698E0A /* HTMLEncodingTests.swift */; };
500B2756239524E100C304D4 /* Diagnostics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 500B274C239524E100C304D4 /* Diagnostics.framework */; };
500B275D239524E100C304D4 /* Diagnostics.h in Headers */ = {isa = PBXBuildFile; fileRef = 500B274F239524E100C304D4 /* Diagnostics.h */; settings = {ATTRIBUTES = (Public, ); }; };
500B276823953E4100C304D4 /* DiagnosticsReporter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 500B276723953E4100C304D4 /* DiagnosticsReporter.swift */; };
Expand Down Expand Up @@ -46,6 +47,7 @@

/* Begin PBXFileReference section */
416CE0172406D85F00698E0A /* HTMLEncoding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HTMLEncoding.swift; sourceTree = "<group>"; };
416CE0CF241FA65700698E0A /* HTMLEncodingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HTMLEncodingTests.swift; sourceTree = "<group>"; };
500B274C239524E100C304D4 /* Diagnostics.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Diagnostics.framework; sourceTree = BUILT_PRODUCTS_DIR; };
500B274F239524E100C304D4 /* Diagnostics.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Diagnostics.h; sourceTree = "<group>"; };
500B2750239524E100C304D4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
Expand Down Expand Up @@ -135,6 +137,7 @@
509F59322396920E006AD8D1 /* Extensions */,
509F5935239694A0006AD8D1 /* Reporters */,
500B27AD2395528100C304D4 /* DiagnosticsReporterTests.swift */,
416CE0CF241FA65700698E0A /* HTMLEncodingTests.swift */,
500B27B12395553000C304D4 /* HTMLGeneratingTests.swift */,
500B275C239524E100C304D4 /* Info.plist */,
500B27C923968CA900C304D4 /* Mocks.swift */,
Expand Down Expand Up @@ -317,7 +320,7 @@
/* Begin PBXShellScriptBuildPhase section */
500B27C723959EB500C304D4 /* SwiftLint */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
buildActionMask = 12;
files = (
);
inputFileListPaths = (
Expand Down Expand Up @@ -362,6 +365,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
416CE0D0241FA65700698E0A /* HTMLEncodingTests.swift in Sources */,
500B27B22395553000C304D4 /* HTMLGeneratingTests.swift in Sources */,
509F59392396973F006AD8D1 /* UserDefaultsReporterTests.swift in Sources */,
500B27CA23968CA900C304D4 /* Mocks.swift in Sources */,
Expand Down
21 changes: 21 additions & 0 deletions DiagnosticsTests/HTMLEncodingTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// HTMLEncodingTests.swift
// DiagnosticsTests
//
// Created by David Steppenbeck on 2020/03/16.
// Copyright © 2020 WeTransfer. All rights reserved.
//

import XCTest
@testable import Diagnostics

final class HTMLEncodingTests: XCTestCase {

/// It should correctly transform a String to HTML.
func testAddingHTMLEncoding() {
let value = "<CONTENT>"
let expectedHTML = "&lt;CONTENT&gt;"
XCTAssertEqual(value.addingHTMLEncoding(), expectedHTML)
}

}

0 comments on commit 94c0f4b

Please sign in to comment.