Skip to content

Commit c8263ef

Browse files
Fix asyncArrayBufferBorrowNativeBackedTest unconditional skip on Hermes
Summary: ## Changelog: [General][Fixed] Fix asyncArrayBufferBorrowNativeBackedTest unconditional skip on Hermes On runtimes that don't implement `tryGetMutableBuffer` (e.g. Hermes / Android-32bit), `asyncArrayBufferBorrowNativeBackedTest` always called `GTEST_SKIP()`, which surfaced as a perpetually-skipped test in CI. Replace the skip with `EXPECT_JSI_THROW(AsyncArrayBuffer::borrow(...))`. On runtimes without `tryGetMutableBuffer`, `borrow` is documented to throw because there is no native `MutableBuffer` to hand back, so this is the meaningful behavior to assert. On runtimes that do implement `tryGetMutableBuffer`, the existing zero-copy assertions are unchanged. ___ Differential Revision: D108657073
1 parent dd5c383 commit c8263ef

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

packages/react-native/ReactCommon/react/bridging/tests/BridgingTest.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -843,15 +843,16 @@ TEST_F(BridgingTest, asyncArrayBufferBorrowThrowsOnJsHeapTest) {
843843
}
844844

845845
TEST_F(BridgingTest, asyncArrayBufferBorrowNativeBackedTest) {
846-
// Native-backed buffer: borrow succeeds, zero-copy. Only meaningful on
847-
// runtimes that implement tryGetMutableBuffer.
846+
// Native-backed buffer: borrow succeeds zero-copy on runtimes that implement
847+
// tryGetMutableBuffer; otherwise borrow throws (since there is no native
848+
// MutableBuffer to hand back).
848849
auto nativeBuf =
849850
std::make_shared<detail::OwnedBytesBuffer>(std::vector<uint8_t>{5, 6, 7});
850851
auto* rawPtr = nativeBuf.get();
851852
auto jsBuf = jsi::ArrayBuffer(rt, nativeBuf);
852853
if (jsBuf.tryGetMutableBuffer(rt) == nullptr) {
853-
GTEST_SKIP()
854-
<< "Runtime does not expose tryGetMutableBuffer; borrow always throws";
854+
EXPECT_JSI_THROW(AsyncArrayBuffer::borrow(rt, jsBuf));
855+
return;
855856
}
856857
auto safe = AsyncArrayBuffer::borrow(rt, jsBuf);
857858
EXPECT_EQ(3, safe.size());

0 commit comments

Comments
 (0)