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

Function test_map_check_this_arg

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

Source from the content-addressed store, hash-verified

1139
1140
1141def test_map_check_this_arg():
1142 items = ['Four', 'Three', 'One']
1143 result = [None]
1144 pm.eval(
1145 """
1146 (result, arr) => {
1147 class Counter {
1148 constructor()
1149 {
1150 this.count = 0;
1151 }
1152 add(array) {
1153 array.map(function countEntry(entry) { ++this.count; }, this);
1154 }
1155 }
1156 const obj = new Counter();
1157 obj.add(arr);
1158 result[0] = obj.count;
1159 }
1160 """
1161 )(result, items)
1162 assert result == [3]
1163
1164
1165def test_map_too_few_args():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected