@@ -1488,48 +1488,44 @@ TEST_P(JSITest, NativeState) {
1488
1488
std::dynamic_pointer_cast<IntState>(holder.getNativeState (rt))->value ,
1489
1489
21 );
1490
1490
1491
- // There's currently way to "delete" the native state of a component fully
1492
- // Even when reset with nullptr, hasNativeState will still return true
1493
- // TODO: Make it pass for Hermes and V8
1494
- // holder.setNativeState(rt, nullptr);
1495
- // EXPECT_TRUE(holder.hasNativeState(rt));
1496
- // EXPECT_TRUE(holder.getNativeState(rt) == nullptr);
1491
+ holder.setNativeState (rt, nullptr );
1492
+ EXPECT_TRUE (holder.hasNativeState (rt));
1493
+ EXPECT_TRUE (holder.getNativeState (rt) == nullptr );
1497
1494
}
1498
1495
1499
- // TODO: Make it pass on Hermes
1500
- // TEST_P(JSITest, NativeStateSymbolOverrides) {
1501
- // Object holder(rt);
1502
-
1503
- // auto stateValue = std::make_shared<IntState>(42);
1504
- // holder.setNativeState(rt, stateValue);
1505
-
1506
- // // Attempting to change configurable attribute of unconfigurable property
1507
- // try {
1508
- // function(
1509
- // "function (obj) {"
1510
- // " var mySymbol = Symbol();"
1511
- // " obj[mySymbol] = 'foo';"
1512
- // " var allSymbols = Object.getOwnPropertySymbols(obj);"
1513
- // " for (var sym of allSymbols) {"
1514
- // " Object.defineProperty(obj, sym, {configurable: true, writable:
1515
- // true});" " obj[sym] = 'bar';" " }"
1516
- // "}")
1517
- // .call(rt, holder);
1518
- // } catch (const JSError& ex) {
1519
- // // On JSC this throws, but it doesn't on Hermes
1520
- // std::string exc = ex.what();
1521
- // EXPECT_NE(
1522
- // exc.find(
1523
- // "Attempting to change configurable attribute of unconfigurable
1524
- // property"),
1525
- // std::string::npos);
1526
- // }
1527
-
1528
- // EXPECT_TRUE(holder.hasNativeState(rt));
1529
- // EXPECT_EQ(
1530
- // std::dynamic_pointer_cast<IntState>(holder.getNativeState(rt))->value,
1531
- // 42);
1532
- // }
1496
+ TEST_P (JSITest, NativeStateSymbolOverrides) {
1497
+ Object holder (rt);
1498
+
1499
+ auto stateValue = std::make_shared<IntState>(42 );
1500
+ holder.setNativeState (rt, stateValue);
1501
+
1502
+ // Attempting to change configurable attribute of unconfigurable property
1503
+ try {
1504
+ function (
1505
+ " function (obj) {"
1506
+ " var mySymbol = Symbol();"
1507
+ " obj[mySymbol] = 'foo';"
1508
+ " var allSymbols = Object.getOwnPropertySymbols(obj);"
1509
+ " for (var sym of allSymbols) {"
1510
+ " Object.defineProperty(obj, sym, {configurable: true, writable:
1511
+ true});" " obj[sym] = 'bar';" " }"
1512
+ " }" )
1513
+ .call (rt, holder);
1514
+ } catch (const JSError& ex) {
1515
+ // On JSC this throws, but it doesn't on Hermes
1516
+ std::string exc = ex.what ();
1517
+ EXPECT_NE (
1518
+ exc.find (
1519
+ " Attempting to change configurable attribute of unconfigurable
1520
+ property" ),
1521
+ std::string::npos);
1522
+ }
1523
+
1524
+ EXPECT_TRUE (holder.hasNativeState (rt));
1525
+ EXPECT_EQ (
1526
+ std::dynamic_pointer_cast<IntState>(holder.getNativeState (rt))->value ,
1527
+ 42 );
1528
+ }
1533
1529
1534
1530
TEST_P (JSITest, UTF8ExceptionTest) {
1535
1531
// Test that a native exception containing UTF-8 characters is correctly
@@ -1550,7 +1546,6 @@ TEST_P(JSITest, UTF8ExceptionTest) {
1550
1546
}
1551
1547
}
1552
1548
1553
- /* [Windows #14185
1554
1549
TEST_P (JSITest, UTF16ConversionTest) {
1555
1550
// This Runtime Decorator is used to test the conversion from UTF-8 to UTF-16
1556
1551
// in the default utf16 method for runtimes that do not provide their own
@@ -1658,10 +1653,8 @@ TEST_P(JSITest, CreateFromUtf16Test) {
1658
1653
auto cp = eval (" loneSurrogate.charCodeAt(0)" ).getNumber ();
1659
1654
EXPECT_EQ (cp, 55357 ); // 0xD83D in decimal
1660
1655
}
1661
- Windows] */
1656
+ Windows]
1662
1657
1663
- /*
1664
- [Windows
1665
1658
TEST_P (JSITest, GetStringDataTest) {
1666
1659
// This Runtime Decorator is used to test the default getStringData
1667
1660
// implementation for VMs that do not provide their own implementation
@@ -1750,7 +1743,6 @@ TEST_P(JSITest, ObjectCreateWithPrototype) {
1750
1743
child = Object::create (rd, Value::null ());
1751
1744
EXPECT_TRUE (child.getPrototype (rd).isNull ());
1752
1745
}
1753
- Windows] */
1754
1746
1755
1747
INSTANTIATE_TEST_CASE_P (
1756
1748
Runtimes,
0 commit comments