Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
Zip
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Jira
Jira
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
YongYue
Zip
Commits
361c51ba
Commit
361c51ba
authored
Jul 28, 2016
by
Mostafa Berg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+Updated tests to user Swift 3.0, all tests passing
parent
a34b598d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
76 deletions
+75
-76
ZipTests/ZipTests.swift
ZipTests/ZipTests.swift
+75
-76
No files found.
ZipTests/ZipTests.swift
View file @
361c51ba
...
@@ -21,10 +21,10 @@ class ZipTests: XCTestCase {
...
@@ -21,10 +21,10 @@ class ZipTests: XCTestCase {
func
testQuickUnzip
()
{
func
testQuickUnzip
()
{
do
{
do
{
let
filePath
=
NSBundle
(
forClass
:
ZipTests
.
self
)
.
URL
ForResource
(
"bb8"
,
withExtension
:
"zip"
)
!
let
filePath
=
Bundle
(
for
:
ZipTests
.
self
)
.
url
ForResource
(
"bb8"
,
withExtension
:
"zip"
)
!
let
destinationURL
=
try
Zip
.
quickUnzipFile
(
filePath
)
let
destinationURL
=
try
Zip
.
quickUnzipFile
(
filePath
)
let
fileManager
=
NSFileManager
.
defaultManager
()
let
fileManager
=
FileManager
.
default
XCTAssertTrue
(
fileManager
.
fileExists
AtPath
(
destinationURL
.
path
!
))
XCTAssertTrue
(
fileManager
.
fileExists
(
atPath
:
destinationURL
.
path
!
))
}
}
catch
{
catch
{
XCTFail
()
XCTFail
()
...
@@ -33,11 +33,11 @@ class ZipTests: XCTestCase {
...
@@ -33,11 +33,11 @@ class ZipTests: XCTestCase {
func
testQuickUnzipNonExistingPath
()
{
func
testQuickUnzipNonExistingPath
()
{
do
{
do
{
let
filePathURL
=
NSBundle
(
forClass
:
ZipTests
.
self
)
.
resourcePath
let
filePathURL
=
Bundle
(
for
:
ZipTests
.
self
)
.
resourcePath
let
filePath
=
NSURL
(
string
:
"
\(
filePathURL
!
)
/bb9.zip"
)
let
filePath
=
NSURL
(
string
:
"
\(
filePathURL
!
)
/bb9.zip"
)
let
destinationURL
=
try
Zip
.
quickUnzipFile
(
filePath
!
)
let
destinationURL
=
try
Zip
.
quickUnzipFile
(
filePath
!
as
URL
)
let
fileManager
=
NSFileManager
.
defaultManager
()
let
fileManager
=
FileManager
.
default
XCTAssertFalse
(
fileManager
.
fileExists
AtPath
(
destinationURL
.
path
!
))
XCTAssertFalse
(
fileManager
.
fileExists
(
atPath
:
destinationURL
.
path
!
))
}
}
catch
{
catch
{
XCTAssert
(
true
)
XCTAssert
(
true
)
...
@@ -46,10 +46,10 @@ class ZipTests: XCTestCase {
...
@@ -46,10 +46,10 @@ class ZipTests: XCTestCase {
func
testQuickUnzipNonZipPath
()
{
func
testQuickUnzipNonZipPath
()
{
do
{
do
{
let
filePath
=
NSBundle
(
forClass
:
ZipTests
.
self
)
.
URL
ForResource
(
"3crBXeO"
,
withExtension
:
"gif"
)
!
let
filePath
=
Bundle
(
for
:
ZipTests
.
self
)
.
url
ForResource
(
"3crBXeO"
,
withExtension
:
"gif"
)
!
let
destinationURL
=
try
Zip
.
quickUnzipFile
(
filePath
)
let
destinationURL
=
try
Zip
.
quickUnzipFile
(
filePath
)
let
fileManager
=
NSFileManager
.
defaultManager
()
let
fileManager
=
FileManager
.
default
XCTAssertFalse
(
fileManager
.
fileExists
AtPath
(
destinationURL
.
path
!
))
XCTAssertFalse
(
fileManager
.
fileExists
(
atPath
:
destinationURL
.
path
!
))
}
}
catch
{
catch
{
XCTAssert
(
true
)
XCTAssert
(
true
)
...
@@ -58,7 +58,7 @@ class ZipTests: XCTestCase {
...
@@ -58,7 +58,7 @@ class ZipTests: XCTestCase {
func
testQuickUnzipProgress
()
{
func
testQuickUnzipProgress
()
{
do
{
do
{
let
filePath
=
NSBundle
(
forClass
:
ZipTests
.
self
)
.
URL
ForResource
(
"bb8"
,
withExtension
:
"zip"
)
!
let
filePath
=
Bundle
(
for
:
ZipTests
.
self
)
.
url
ForResource
(
"bb8"
,
withExtension
:
"zip"
)
!
try
Zip
.
quickUnzipFile
(
filePath
,
progress
:
{
(
progress
)
->
()
in
try
Zip
.
quickUnzipFile
(
filePath
,
progress
:
{
(
progress
)
->
()
in
XCTAssert
(
true
)
XCTAssert
(
true
)
})
})
...
@@ -71,9 +71,9 @@ class ZipTests: XCTestCase {
...
@@ -71,9 +71,9 @@ class ZipTests: XCTestCase {
func
testQuickUnzipOnlineURL
()
{
func
testQuickUnzipOnlineURL
()
{
do
{
do
{
let
filePath
=
NSURL
(
string
:
"http://www.google.com/google.zip"
)
!
let
filePath
=
NSURL
(
string
:
"http://www.google.com/google.zip"
)
!
let
destinationURL
=
try
Zip
.
quickUnzipFile
(
filePath
)
let
destinationURL
=
try
Zip
.
quickUnzipFile
(
filePath
as
URL
)
let
fileManager
=
NSFileManager
.
defaultManager
()
let
fileManager
=
FileManager
.
default
XCTAssertFalse
(
fileManager
.
fileExists
AtPath
(
destinationURL
.
path
!
))
XCTAssertFalse
(
fileManager
.
fileExists
(
atPath
:
destinationURL
.
path
!
))
}
}
catch
{
catch
{
XCTAssert
(
true
)
XCTAssert
(
true
)
...
@@ -82,15 +82,15 @@ class ZipTests: XCTestCase {
...
@@ -82,15 +82,15 @@ class ZipTests: XCTestCase {
func
testUnzip
()
{
func
testUnzip
()
{
do
{
do
{
let
filePath
=
NSBundle
(
forClass
:
ZipTests
.
self
)
.
URL
ForResource
(
"bb8"
,
withExtension
:
"zip"
)
!
let
filePath
=
Bundle
(
for
:
ZipTests
.
self
)
.
url
ForResource
(
"bb8"
,
withExtension
:
"zip"
)
!
let
documentsFolder
=
NSFileManager
.
defaultManager
()
.
URLsForDirectory
(
.
DocumentDirectory
,
inDomains
:
.
U
serDomainMask
)[
0
]
as
NSURL
let
documentsFolder
=
FileManager
.
default
.
urlsForDirectory
(
.
documentDirectory
,
inDomains
:
.
u
serDomainMask
)[
0
]
as
NSURL
try
Zip
.
unzipFile
(
filePath
,
destination
:
documentsFolder
,
overwrite
:
true
,
password
:
"password"
,
progress
:
{
(
progress
)
->
()
in
try
Zip
.
unzipFile
(
filePath
,
destination
:
documentsFolder
as
URL
,
overwrite
:
true
,
password
:
"password"
,
progress
:
{
(
progress
)
->
()
in
print
(
progress
)
print
(
progress
)
})
})
let
fileManager
=
NSFileManager
.
defaultManager
()
let
fileManager
=
FileManager
.
default
XCTAssertTrue
(
fileManager
.
fileExists
AtPath
(
documentsFolder
.
path
!
))
XCTAssertTrue
(
fileManager
.
fileExists
(
atPath
:
documentsFolder
.
path
!
))
}
}
catch
{
catch
{
XCTFail
()
XCTFail
()
...
@@ -99,14 +99,14 @@ class ZipTests: XCTestCase {
...
@@ -99,14 +99,14 @@ class ZipTests: XCTestCase {
func
testImplicitProgressUnzip
()
{
func
testImplicitProgressUnzip
()
{
do
{
do
{
let
progress
=
NS
Progress
()
let
progress
=
Progress
()
progress
.
totalUnitCount
=
1
progress
.
totalUnitCount
=
1
let
filePath
=
NSBundle
(
forClass
:
ZipTests
.
self
)
.
URL
ForResource
(
"bb8"
,
withExtension
:
"zip"
)
!
let
filePath
=
Bundle
(
for
:
ZipTests
.
self
)
.
url
ForResource
(
"bb8"
,
withExtension
:
"zip"
)
!
let
documentsFolder
=
NSFileManager
.
defaultManager
()
.
URLsForDirectory
(
.
DocumentDirectory
,
inDomains
:
.
U
serDomainMask
)[
0
]
as
NSURL
let
documentsFolder
=
FileManager
.
default
.
urlsForDirectory
(
.
documentDirectory
,
inDomains
:
.
u
serDomainMask
)[
0
]
as
NSURL
progress
.
becomeCurrent
WithPendingUnitCount
(
1
)
progress
.
becomeCurrent
(
withPendingUnitCount
:
1
)
try
Zip
.
unzipFile
(
filePath
,
destination
:
documentsFolder
,
overwrite
:
true
,
password
:
"password"
,
progress
:
nil
)
try
Zip
.
unzipFile
(
filePath
,
destination
:
documentsFolder
as
URL
,
overwrite
:
true
,
password
:
"password"
,
progress
:
nil
)
progress
.
resignCurrent
()
progress
.
resignCurrent
()
XCTAssertTrue
(
progress
.
totalUnitCount
==
progress
.
completedUnitCount
)
XCTAssertTrue
(
progress
.
totalUnitCount
==
progress
.
completedUnitCount
)
...
@@ -119,16 +119,16 @@ class ZipTests: XCTestCase {
...
@@ -119,16 +119,16 @@ class ZipTests: XCTestCase {
func
testImplicitProgressZip
()
{
func
testImplicitProgressZip
()
{
do
{
do
{
let
progress
=
NS
Progress
()
let
progress
=
Progress
()
progress
.
totalUnitCount
=
1
progress
.
totalUnitCount
=
1
let
imageURL1
=
NSBundle
(
forClass
:
ZipTests
.
self
)
.
URL
ForResource
(
"3crBXeO"
,
withExtension
:
"gif"
)
!
let
imageURL1
=
Bundle
(
for
:
ZipTests
.
self
)
.
url
ForResource
(
"3crBXeO"
,
withExtension
:
"gif"
)
!
let
imageURL2
=
NSBundle
(
forClass
:
ZipTests
.
self
)
.
URL
ForResource
(
"kYkLkPf"
,
withExtension
:
"gif"
)
!
let
imageURL2
=
Bundle
(
for
:
ZipTests
.
self
)
.
url
ForResource
(
"kYkLkPf"
,
withExtension
:
"gif"
)
!
let
documentsFolder
=
NSFileManager
.
defaultManager
()
.
URLsForDirectory
(
.
DocumentDirectory
,
inDomains
:
.
U
serDomainMask
)[
0
]
as
NSURL
let
documentsFolder
=
FileManager
.
default
.
urlsForDirectory
(
.
documentDirectory
,
inDomains
:
.
u
serDomainMask
)[
0
]
as
NSURL
let
zipFilePath
=
documentsFolder
.
URLByA
ppendingPathComponent
(
"archive.zip"
)
let
zipFilePath
=
documentsFolder
.
a
ppendingPathComponent
(
"archive.zip"
)
progress
.
becomeCurrent
WithPendingUnitCount
(
1
)
progress
.
becomeCurrent
(
withPendingUnitCount
:
1
)
try
Zip
.
zipFiles
([
imageURL1
,
imageURL2
],
zipFilePath
:
zipFilePath
,
password
:
nil
,
progress
:
nil
)
try
Zip
.
zipFiles
([
imageURL1
,
imageURL2
],
zipFilePath
:
zipFilePath
!
,
password
:
nil
,
progress
:
nil
)
progress
.
resignCurrent
()
progress
.
resignCurrent
()
XCTAssertTrue
(
progress
.
totalUnitCount
==
progress
.
completedUnitCount
)
XCTAssertTrue
(
progress
.
totalUnitCount
==
progress
.
completedUnitCount
)
...
@@ -141,11 +141,11 @@ class ZipTests: XCTestCase {
...
@@ -141,11 +141,11 @@ class ZipTests: XCTestCase {
func
testQuickZip
()
{
func
testQuickZip
()
{
do
{
do
{
let
imageURL1
=
NSBundle
(
forClass
:
ZipTests
.
self
)
.
URL
ForResource
(
"3crBXeO"
,
withExtension
:
"gif"
)
!
let
imageURL1
=
Bundle
(
for
:
ZipTests
.
self
)
.
url
ForResource
(
"3crBXeO"
,
withExtension
:
"gif"
)
!
let
imageURL2
=
NSBundle
(
forClass
:
ZipTests
.
self
)
.
URL
ForResource
(
"kYkLkPf"
,
withExtension
:
"gif"
)
!
let
imageURL2
=
Bundle
(
for
:
ZipTests
.
self
)
.
url
ForResource
(
"kYkLkPf"
,
withExtension
:
"gif"
)
!
let
destinationURL
=
try
Zip
.
quickZipFiles
([
imageURL1
,
imageURL2
],
fileName
:
"archive"
)
let
destinationURL
=
try
Zip
.
quickZipFiles
([
imageURL1
,
imageURL2
],
fileName
:
"archive"
)
let
fileManager
=
NSFileManager
.
defaultManager
()
let
fileManager
=
FileManager
.
default
XCTAssertTrue
(
fileManager
.
fileExists
AtPath
(
destinationURL
.
path
!
))
XCTAssertTrue
(
fileManager
.
fileExists
(
atPath
:
destinationURL
.
path
!
))
}
}
catch
{
catch
{
XCTFail
()
XCTFail
()
...
@@ -154,20 +154,20 @@ class ZipTests: XCTestCase {
...
@@ -154,20 +154,20 @@ class ZipTests: XCTestCase {
func
testQuickZipFolder
()
{
func
testQuickZipFolder
()
{
do
{
do
{
let
fileManager
=
NSFileManager
.
defaultManager
()
let
fileManager
=
FileManager
.
default
let
imageURL1
=
NSBundle
(
forClass
:
ZipTests
.
self
)
.
URL
ForResource
(
"3crBXeO"
,
withExtension
:
"gif"
)
!
let
imageURL1
=
Bundle
(
for
:
ZipTests
.
self
)
.
url
ForResource
(
"3crBXeO"
,
withExtension
:
"gif"
)
!
let
imageURL2
=
NSBundle
(
forClass
:
ZipTests
.
self
)
.
URL
ForResource
(
"kYkLkPf"
,
withExtension
:
"gif"
)
!
let
imageURL2
=
Bundle
(
for
:
ZipTests
.
self
)
.
url
ForResource
(
"kYkLkPf"
,
withExtension
:
"gif"
)
!
let
folderURL
=
NSBundle
(
forClass
:
ZipTests
.
self
)
.
bundleURL
.
URLByA
ppendingPathComponent
(
"Directory"
)
let
folderURL
=
try
Bundle
(
for
:
ZipTests
.
self
)
.
bundleURL
.
a
ppendingPathComponent
(
"Directory"
)
let
targetImageURL1
=
folderURL
.
URLByA
ppendingPathComponent
(
"3crBXeO.gif"
)
let
targetImageURL1
=
try
folderURL
.
a
ppendingPathComponent
(
"3crBXeO.gif"
)
let
targetImageURL2
=
folderURL
.
URLByA
ppendingPathComponent
(
"kYkLkPf.gif"
)
let
targetImageURL2
=
try
folderURL
.
a
ppendingPathComponent
(
"kYkLkPf.gif"
)
if
fileManager
.
fileExists
AtPath
(
folderURL
.
path
!
)
{
if
fileManager
.
fileExists
(
atPath
:
folderURL
.
path
!
)
{
try
fileManager
.
removeItem
AtURL
(
folderURL
)
try
fileManager
.
removeItem
(
at
:
folderURL
)
}
}
try
fileManager
.
createDirectory
AtURL
(
folderURL
,
withIntermediateDirectories
:
false
,
attributes
:
nil
)
try
fileManager
.
createDirectory
(
at
:
folderURL
,
withIntermediateDirectories
:
false
,
attributes
:
nil
)
try
fileManager
.
copyItem
AtURL
(
imageURL1
,
toURL
:
targetImageURL1
)
try
fileManager
.
copyItem
(
at
:
imageURL1
,
to
:
targetImageURL1
)
try
fileManager
.
copyItem
AtURL
(
imageURL2
,
toURL
:
targetImageURL2
)
try
fileManager
.
copyItem
(
at
:
imageURL2
,
to
:
targetImageURL2
)
let
destinationURL
=
try
Zip
.
quickZipFiles
([
folderURL
],
fileName
:
"directory"
)
let
destinationURL
=
try
Zip
.
quickZipFiles
([
folderURL
],
fileName
:
"directory"
)
XCTAssertTrue
(
fileManager
.
fileExists
AtPath
(
destinationURL
.
path
!
))
XCTAssertTrue
(
fileManager
.
fileExists
(
atPath
:
destinationURL
.
path
!
))
}
}
catch
{
catch
{
XCTFail
()
XCTFail
()
...
@@ -177,15 +177,15 @@ class ZipTests: XCTestCase {
...
@@ -177,15 +177,15 @@ class ZipTests: XCTestCase {
func
testZip
()
{
func
testZip
()
{
do
{
do
{
let
imageURL1
=
NSBundle
(
forClass
:
ZipTests
.
self
)
.
URL
ForResource
(
"3crBXeO"
,
withExtension
:
"gif"
)
!
let
imageURL1
=
Bundle
(
for
:
ZipTests
.
self
)
.
url
ForResource
(
"3crBXeO"
,
withExtension
:
"gif"
)
!
let
imageURL2
=
NSBundle
(
forClass
:
ZipTests
.
self
)
.
URL
ForResource
(
"kYkLkPf"
,
withExtension
:
"gif"
)
!
let
imageURL2
=
Bundle
(
for
:
ZipTests
.
self
)
.
url
ForResource
(
"kYkLkPf"
,
withExtension
:
"gif"
)
!
let
documentsFolder
=
NSFileManager
.
defaultManager
()
.
URLsForDirectory
(
.
DocumentDirectory
,
inDomains
:
.
U
serDomainMask
)[
0
]
as
NSURL
let
documentsFolder
=
FileManager
.
default
.
urlsForDirectory
(
.
documentDirectory
,
inDomains
:
.
u
serDomainMask
)[
0
]
as
NSURL
let
zipFilePath
=
documentsFolder
.
URLByA
ppendingPathComponent
(
"archive.zip"
)
let
zipFilePath
=
documentsFolder
.
a
ppendingPathComponent
(
"archive.zip"
)
try
Zip
.
zipFiles
([
imageURL1
,
imageURL2
],
zipFilePath
:
zipFilePath
,
password
:
nil
,
progress
:
{
(
progress
)
->
()
in
try
Zip
.
zipFiles
([
imageURL1
,
imageURL2
],
zipFilePath
:
zipFilePath
!
,
password
:
nil
,
progress
:
{
(
progress
)
->
()
in
print
(
progress
)
print
(
progress
)
})
})
let
fileManager
=
NSFileManager
.
defaultManager
()
let
fileManager
=
FileManager
.
default
XCTAssertTrue
(
fileManager
.
fileExists
AtPath
(
zipFilePath
.
path
!
))
XCTAssertTrue
(
fileManager
.
fileExists
(
atPath
:(
zipFilePath
?
.
path
!
)
!
))
}
}
catch
{
catch
{
XCTFail
()
XCTFail
()
...
@@ -194,23 +194,23 @@ class ZipTests: XCTestCase {
...
@@ -194,23 +194,23 @@ class ZipTests: XCTestCase {
func
testZipUnzipPassword
()
{
func
testZipUnzipPassword
()
{
do
{
do
{
let
imageURL1
=
NSBundle
(
forClass
:
ZipTests
.
self
)
.
URL
ForResource
(
"3crBXeO"
,
withExtension
:
"gif"
)
!
let
imageURL1
=
Bundle
(
for
:
ZipTests
.
self
)
.
url
ForResource
(
"3crBXeO"
,
withExtension
:
"gif"
)
!
let
imageURL2
=
NSBundle
(
forClass
:
ZipTests
.
self
)
.
URL
ForResource
(
"kYkLkPf"
,
withExtension
:
"gif"
)
!
let
imageURL2
=
Bundle
(
for
:
ZipTests
.
self
)
.
url
ForResource
(
"kYkLkPf"
,
withExtension
:
"gif"
)
!
let
documentsFolder
=
NSFileManager
.
defaultManager
()
.
URLsForDirectory
(
.
DocumentDirectory
,
inDomains
:
.
U
serDomainMask
)[
0
]
as
NSURL
let
documentsFolder
=
FileManager
.
default
.
urlsForDirectory
(
.
documentDirectory
,
inDomains
:
.
u
serDomainMask
)[
0
]
as
NSURL
let
zipFilePath
=
documentsFolder
.
URLByA
ppendingPathComponent
(
"archive.zip"
)
let
zipFilePath
=
documentsFolder
.
a
ppendingPathComponent
(
"archive.zip"
)
try
Zip
.
zipFiles
([
imageURL1
,
imageURL2
],
zipFilePath
:
zipFilePath
,
password
:
"password"
,
progress
:
{
(
progress
)
->
()
in
try
Zip
.
zipFiles
([
imageURL1
,
imageURL2
],
zipFilePath
:
zipFilePath
!
,
password
:
"password"
,
progress
:
{
(
progress
)
->
()
in
print
(
progress
)
print
(
progress
)
})
})
let
fileManager
=
NSFileManager
.
defaultManager
()
let
fileManager
=
FileManager
.
default
XCTAssertTrue
(
fileManager
.
fileExists
AtPath
(
zipFilePath
.
path
!
))
XCTAssertTrue
(
fileManager
.
fileExists
(
atPath
:(
zipFilePath
?
.
path
!
)
!
))
guard
let
fileExtension
=
zipFilePath
.
pathExtension
,
let
fileName
=
zipFilePath
.
lastPathComponent
else
{
guard
let
fileExtension
=
zipFilePath
?
.
pathExtension
,
let
fileName
=
zipFilePath
?
.
lastPathComponent
else
{
throw
ZipError
.
U
nzipFail
throw
ZipError
.
u
nzipFail
}
}
let
directoryName
=
fileName
.
stringByReplacingOccurrencesOfString
(
".
\(
fileExtension
)
"
,
withString
:
""
)
let
directoryName
=
fileName
.
replacingOccurrences
(
of
:
".
\(
fileExtension
)
"
,
with
:
""
)
let
documentsUrl
=
fileManager
.
URLsForDirectory
(
.
DocumentDirectory
,
inDomains
:
.
U
serDomainMask
)[
0
]
as
NSURL
let
documentsUrl
=
fileManager
.
urlsForDirectory
(
.
documentDirectory
,
inDomains
:
.
u
serDomainMask
)[
0
]
as
NSURL
let
destinationUrl
=
documentsUrl
.
URLByA
ppendingPathComponent
(
directoryName
,
isDirectory
:
true
)
let
destinationUrl
=
documentsUrl
.
a
ppendingPathComponent
(
directoryName
,
isDirectory
:
true
)
try
Zip
.
unzipFile
(
zipFilePath
,
destination
:
destinationUrl
,
overwrite
:
true
,
password
:
"password"
,
progress
:
nil
)
try
Zip
.
unzipFile
(
zipFilePath
!
,
destination
:
destinationUrl
!
,
overwrite
:
true
,
password
:
"password"
,
progress
:
nil
)
XCTAssertTrue
(
fileManager
.
fileExists
AtPath
(
destinationUrl
.
path
!
))
XCTAssertTrue
(
fileManager
.
fileExists
(
atPath
:(
destinationUrl
?
.
path
!
)
!
))
}
}
catch
{
catch
{
XCTFail
()
XCTFail
()
...
@@ -220,16 +220,15 @@ class ZipTests: XCTestCase {
...
@@ -220,16 +220,15 @@ class ZipTests: XCTestCase {
func
testQuickUnzipSubDir
()
{
func
testQuickUnzipSubDir
()
{
do
{
do
{
let
bookURL
=
NSBundle
(
forClass
:
ZipTests
.
self
)
.
URL
ForResource
(
"bb8"
,
withExtension
:
"zip"
)
!
let
bookURL
=
Bundle
(
for
:
ZipTests
.
self
)
.
url
ForResource
(
"bb8"
,
withExtension
:
"zip"
)
!
let
unzipDestination
=
try
Zip
.
quickUnzipFile
(
bookURL
)
let
unzipDestination
=
try
Zip
.
quickUnzipFile
(
bookURL
)
let
fileManager
=
NSFileManager
.
defaultManager
()
let
fileManager
=
FileManager
.
default
let
subDir
=
try
unzipDestination
.
appendingPathComponent
(
"subDir"
)
let
subDir
=
unzipDestination
.
URLByAppendingPathComponent
(
"subDir"
)
let
imageURL
=
try
subDir
.
appendingPathComponent
(
"r2W9yu9"
)
.
appendingPathExtension
(
"gif"
)
let
imageURL
=
subDir
.
URLByAppendingPathComponent
(
"r2W9yu9"
)
.
URLByAppendingPathExtension
(
"gif"
)
XCTAssertTrue
(
fileManager
.
fileExists
AtPath
(
unzipDestination
.
path
!
))
XCTAssertTrue
(
fileManager
.
fileExists
(
atPath
:
unzipDestination
.
path
!
))
XCTAssertTrue
(
fileManager
.
fileExists
AtPath
(
subDir
.
path
!
))
XCTAssertTrue
(
fileManager
.
fileExists
(
atPath
:
subDir
.
path
!
))
XCTAssertTrue
(
fileManager
.
fileExists
AtPath
(
imageURL
.
path
!
))
XCTAssertTrue
(
fileManager
.
fileExists
(
atPath
:
imageURL
.
path
!
))
}
catch
{
}
catch
{
XCTFail
()
XCTFail
()
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment