MCPcopy Create free account
hub / github.com/Distributive-Network/PythonMonkey / test_some_check_this_arg

Function test_some_check_this_arg

tests/python/test_arrays.py:1610–1631  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1608
1609
1610def test_some_check_this_arg():
1611 items = ['Four', 'Three', 'One']
1612 result = [None]
1613 pm.eval(
1614 """
1615 (result, arr) => {
1616 class Counter {
1617 constructor()
1618 {
1619 this.count = 0;
1620 }
1621 add(array) {
1622 array.some(function countEntry(entry) { ++this.count; }, this);
1623 }
1624 }
1625 const obj = new Counter();
1626 obj.add(arr);
1627 result[0] = obj.count;
1628 }
1629 """
1630 )(result, items)
1631 assert result == [3]
1632
1633
1634def test_some_truthy_conversion():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected