Skip to content

Commit 5fe4449

Browse files
committed
Improve tests; update to Swift 3.0.1
1 parent 6ecceaa commit 5fe4449

File tree

5 files changed

+32
-29
lines changed

5 files changed

+32
-29
lines changed

.swift-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0
1+
3.0.1

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ before_install:
2323
- git submodule update --init --remote --merge --recursive
2424

2525
script:
26-
- ./Package-Builder/build-package.sh $TRAVIS_BRANCH $TRAVIS_BUILD_DIR
26+
- ./Package-Builder/build-package.sh $TRAVIS_BUILD_DIR

Package-Builder

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
![Apache 2](https://img.shields.io/badge/license-Apache2-blue.svg?style=flat)
77

88
## Summary
9-
Pure Swift HTML encode/decode utility tool for Swift 3.0.
9+
Pure Swift HTML encode/decode utility tool for Swift 3.
1010

1111
Now includes support for HTML5 named character references. You can find the list of all 2231 HTML5 named character references [here](https://www.w3.org/TR/html5/syntax.html#named-character-references).
1212

@@ -24,12 +24,14 @@ In addition, `HTMLEntities` can unescape encoded HTML text that contains decimal
2424

2525
## Version Info
2626

27-
HTMLEntities 2.0 runs on Swift 3.0, on both macOS and Ubuntu Linux.
27+
HTMLEntities 2.0 runs on Swift 3, on both macOS and Ubuntu Linux.
2828

2929
## Usage
3030

3131
### Install via Swift Package Manager (SPM)
3232

33+
Add `HTMLEntities` to your `Package.swift`:
34+
3335
```swift
3436
import PackageDescription
3537

Tests/HTMLEntitiesTests/HTMLEntitiesTest.swift

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ class HTMLEntitiesTests: XCTestCase {
6161

6262
do {
6363
_ = try escaped.htmlUnescape(strict: true)
64-
XCTAssert(false)
64+
XCTFail("Did not throw error")
6565
}
6666
catch ParseError.MissingSemicolon {
6767
XCTAssert(true)
6868
}
6969
catch {
70-
XCTAssert(false)
70+
XCTFail("Wrong error thrown")
7171
}
7272
}
7373

@@ -99,13 +99,13 @@ class HTMLEntitiesTests: XCTestCase {
9999

100100
do {
101101
_ = try decEscaped.htmlUnescape(strict: true)
102-
XCTAssert(false)
102+
XCTFail("Did not throw error")
103103
}
104104
catch ParseError.DeprecatedNumericReference {
105105
XCTAssert(true)
106106
}
107107
catch {
108-
XCTAssert(false)
108+
XCTFail("Wrong error thrown")
109109
}
110110

111111
do {
@@ -116,7 +116,7 @@ class HTMLEntitiesTests: XCTestCase {
116116
XCTAssert(true)
117117
}
118118
catch {
119-
XCTAssert(false)
119+
XCTFail("Wrong error thrown")
120120
}
121121
}
122122

@@ -135,23 +135,24 @@ class HTMLEntitiesTests: XCTestCase {
135135

136136
do {
137137
_ = try decEscaped.htmlUnescape(strict: true)
138-
XCTAssert(false)
138+
XCTFail("Did not throw error")
139139
}
140140
catch ParseError.OutsideValidUnicodeRange {
141141
XCTAssert(true)
142142
}
143143
catch {
144-
XCTAssert(false)
144+
XCTFail("Wrong error thrown")
145145
}
146146

147147
do {
148148
_ = try hexEscaped.htmlUnescape(strict: true)
149+
XCTFail("Did not throw error")
149150
}
150151
catch ParseError.OutsideValidUnicodeRange {
151152
XCTAssert(true)
152153
}
153154
catch {
154-
XCTAssert(false)
155+
XCTFail("Wrong error thrown")
155156
}
156157
}
157158

@@ -178,24 +179,24 @@ class HTMLEntitiesTests: XCTestCase {
178179

179180
do {
180181
_ = try decEscaped.htmlUnescape(strict: true)
181-
XCTAssert(false)
182+
XCTFail("Did not throw error")
182183
}
183184
catch ParseError.DisallowedNumericReference {
184185
XCTAssert(true)
185186
}
186187
catch {
187-
XCTAssert(false)
188+
XCTFail("Wrong error thrown")
188189
}
189190

190191
do {
191192
_ = try hexEscaped.htmlUnescape(strict: true)
192-
XCTAssert(false)
193+
XCTFail("Did not throw error")
193194
}
194195
catch ParseError.DisallowedNumericReference {
195196
XCTAssert(true)
196197
}
197198
catch {
198-
XCTAssert(false)
199+
XCTFail("Wrong error thrown")
199200
}
200201
}
201202
}
@@ -238,41 +239,41 @@ class HTMLEntitiesTests: XCTestCase {
238239

239240
do {
240241
_ = try "&#4370ᅡ&#4523".htmlUnescape(strict: true)
241-
XCTAssert(false)
242+
XCTFail("Did not throw error")
242243
}
243244
catch ParseError.MissingSemicolon {
244245
XCTAssert(true)
245246
}
246247
catch {
247-
XCTAssert(false)
248+
XCTFail("Wrong error thrown")
248249
}
249250

250251
let badEntity = "&some &text; here <script> some more; text here;"
251252
XCTAssertEqual(badEntity.htmlUnescape(), "&some &text; here <script> some more; text here;")
252253

253254
do {
254255
_ = try badEntity.htmlUnescape(strict: true)
255-
XCTAssert(false)
256+
XCTFail("Did not throw error")
256257
}
257258
catch ParseError.InvalidNamedReference {
258259
XCTAssert(true)
259260
}
260261
catch {
261-
XCTAssert(false)
262+
XCTFail("Wrong error thrown")
262263
}
263264

264265
let legacyEmbedded = "I'm &notit; I tell you"
265266
XCTAssertEqual(legacyEmbedded.htmlUnescape(), "I'm ¬it; I tell you")
266267

267268
do {
268269
_ = try legacyEmbedded.htmlUnescape(strict: true)
269-
XCTAssert(false)
270+
XCTFail("Did not throw error")
270271
}
271272
catch ParseError.MissingSemicolon {
272273
XCTAssert(true)
273274
}
274275
catch {
275-
XCTAssert(false)
276+
XCTFail("Wrong error thrown")
276277
}
277278

278279
XCTAssertEqual(try "&&#x223E;&#x333;".htmlUnescape(strict: true), "&∾̳")
@@ -281,26 +282,26 @@ class HTMLEntitiesTests: XCTestCase {
281282

282283
do {
283284
_ = try "&#&#x223E;&#x333;".htmlUnescape(strict: true)
284-
XCTAssert(false)
285+
XCTFail("Did not throw error")
285286
}
286287
catch ParseError.MalformedNumericReference {
287288
XCTAssert(true)
288289
}
289290
catch {
290-
XCTAssert(false)
291+
XCTFail("Wrong error thrown")
291292
}
292293

293294
XCTAssertEqual("&#123&#x223E;&#x333;".htmlUnescape(), "{∾̳")
294295

295296
do {
296297
_ = try "&#123&#x223E;&#x333;".htmlUnescape(strict: true)
297-
XCTAssert(false)
298+
XCTFail("Did not throw error")
298299
}
299300
catch ParseError.MissingSemicolon {
300301
XCTAssert(true)
301302
}
302303
catch {
303-
XCTAssert(false)
304+
XCTFail("Wrong error thrown")
304305
}
305306

306307
XCTAssertEqual("&#xABC&#x223E;&#x333;".htmlUnescape(), "઼∾̳")
@@ -335,13 +336,13 @@ class HTMLEntitiesTests: XCTestCase {
335336

336337
do {
337338
_ = try text.htmlUnescape(strict: true)
338-
XCTAssert(false)
339+
XCTFail("Did not throw error")
339340
}
340341
catch ParseError.MissingSemicolon {
341342
XCTAssert(true)
342343
}
343344
catch {
344-
XCTAssert(false)
345+
XCTFail("Wrong error thrown")
345346
}
346347
}
347348

0 commit comments

Comments
 (0)