Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit test for HTML encoding. #64

Merged
merged 1 commit into from
Mar 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}

}