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

Function test_map_self_jsfunction

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

Source from the content-addressed store, hash-verified

1245
1246
1247def test_map_self_jsfunction():
1248 items = ['Four', 'Three', 'One']
1249
1250 result = pm.eval("""
1251 (arr) => {
1252 function increment(element, index, array) {
1253 this.count++
1254 }
1255 let jsObj = {count: 0}
1256 arr.map(increment, jsObj);
1257 return jsObj.count;
1258 }
1259 """)(items)
1260 assert result == 3
1261
1262# filter
1263

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected