Skip to content

Commit

Permalink
Update testReadFromOtherLanguages test to also run on macos (#8044)
Browse files Browse the repository at this point in the history
  • Loading branch information
mustiikhalil authored Nov 19, 2023
1 parent f175e60 commit 0dc5a75
Showing 1 changed file with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ class FlatBuffersMonsterWriterTests: XCTestCase {
}

func testReadFromOtherLanguages() {
let path = FileManager.default.currentDirectoryPath
let url = URL(fileURLWithPath: path, isDirectory: true)
.appendingPathComponent("monsterdata_test").appendingPathExtension("mon")
guard let data = try? Data(contentsOf: url) else { return }
.appendingPathComponent("monsterdata_test")
.appendingPathExtension("mon")
let data = try! Data(contentsOf: url)
let _data = ByteBuffer(data: data)
readVerifiedMonster(fb: _data)
}
Expand Down Expand Up @@ -469,4 +469,19 @@ class FlatBuffersMonsterWriterTests: XCTestCase {
{\"hp\":80,\"inventory\":[0,1,2,3,4],\"test\":{\"name\":\"Fred\"},\"testarrayofstring\":[\"test1\",\"test2\"],\"testarrayoftables\":[{\"name\":\"Barney\"},{\"name\":\"Frodo\"},{\"name\":\"Wilma\"}],\"test4\":[{\"a\":30,\"b\":40},{\"a\":10,\"b\":20}],\"testbool\":true,\"test_type\":\"Monster\",\"pos\":{\"y\":2,\"test3\":{\"a\":5,\"b\":6},\"z\":3,\"x\":1,\"test1\":3,\"test2\":\"Green\"},\"name\":\"MyMonster\"}
"""
}

private var path: String {
#if os(macOS)
// Gets the current path of this test file then
// strips out the nested directories.
let filePath = URL(filePath: #file)
.deletingLastPathComponent()
.deletingLastPathComponent()
.deletingLastPathComponent()
return filePath.absoluteString
#else
return FileManager.default.currentDirectoryPath
#endif
}

}

0 comments on commit 0dc5a75

Please sign in to comment.