mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-01 19:58:15 +00:00
Update testReadFromOtherLanguages test to also run on macos (#8044)
This commit is contained in:
@@ -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)
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user