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

Function test_every_check_this_arg

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

Source from the content-addressed store, hash-verified

1756
1757
1758def test_every_check_this_arg():
1759 items = ['Four', 'Three', 'One']
1760 result = [None]
1761 pm.eval(
1762 """
1763 (result, arr) => {
1764 class Counter {
1765 constructor()
1766 {
1767 this.count = 0;
1768 }
1769 add(array) {
1770 array.every(function countEntry(entry) { ++this.count; }, this);
1771 }
1772 }
1773 const obj = new Counter();
1774 obj.add(arr);
1775 result[0] = obj.count;
1776 }
1777 """
1778 )(result, items)
1779 assert result == [1]
1780
1781
1782def test_every_with_python_function():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected