Skip to content

Commit 02180ab

Browse files
committed
fix some testing
1 parent 735d321 commit 02180ab

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

OpenDocumentReader/CoreWrapper.mm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ - (bool)translate:(NSString *)inputPath cache:(NSString *)cachePath into:(NSStri
100100
} catch (odr::UnknownFileType&) {
101101
_errorCode = @(-5);
102102
return false;
103+
} catch (std::runtime_error &e) {
104+
std::cout << e.what() << std::endl;
105+
_errorCode = @(-3);
106+
return false;
103107
} catch (...) {
104108
_errorCode = @(-3);
105109
return false;

OpenDocumentReaderTests/OpenDocumentReaderTests.swift

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,23 @@ class OpenDocumentReaderTests: XCTestCase {
3535
let url = URL(string: "https://api.libreoffice.org/examples/cpp/DocumentLoader/test.odt")
3636

3737
let downloadTask = URLSession.shared.downloadTask(with: url!) {
38-
urlOrNil, responseOrNil, errorOrNil in
39-
40-
fileURL = urlOrNil
38+
urlOrNil, responseOrNil, errorOrNil in fileURL = urlOrNil
4139
}
4240
downloadTask.resume()
4341
} else {
4442
let filePath = Bundle(for: type(of: self)).path(forResource: "test", ofType: "odt")
4543
fileURL = URL(fileURLWithPath: filePath!)
4644
}
4745

48-
try FileManager.default.moveItem(at: fileURL!, to: self.saveURL!)
46+
try FileManager.default.copyItem(at: fileURL!, to: self.saveURL!)
4947
}
50-
48+
5149
func testExample() throws {
5250
measure {
5351
let coreWrapper = CoreWrapper()
5452

55-
var cachePath = URL(fileURLWithPath: NSTemporaryDirectory())
56-
var outputPath = URL(fileURLWithPath: NSTemporaryDirectory())
53+
let cachePath = URL(fileURLWithPath: NSTemporaryDirectory())
54+
let outputPath = URL(fileURLWithPath: NSTemporaryDirectory())
5755

5856
coreWrapper.translate(saveURL?.path, cache: cachePath.path, into: outputPath.path, with: nil, editable: true)
5957
XCTAssertNil(coreWrapper.errorCode)

0 commit comments

Comments
 (0)