Skip to content

Commit 2f7e124

Browse files
committed
Simplify test case
1 parent 036cf99 commit 2f7e124

File tree

2 files changed

+5
-18
lines changed

2 files changed

+5
-18
lines changed

tests/jsroot/ExactKeysUnitTest.js

+3
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ exports.provideGalStackOverflow = ($dump) => {
8383
$result = {};
8484
$result['foneData'] = false ? [] :
8585
php3.array_map('asd', StringUtil.lines('asd'));
86+
87+
php3.array_map('asd').;
88+
8689
$result.;
8790
return $result;
8891
}

tests/php3.js

+2-18
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@
33
let php = {};
44

55
php.array_slice = (arr, start, length = undefined) => {
6-
arr = Object.values(arr);
7-
if (start < 0) {
8-
start = arr.length + start;
9-
}
10-
length = length === undefined ? arr.length : length;
116
return arr.slice(start, start + length);
127
};
138

@@ -16,22 +11,11 @@ php.array_slice = (arr, start, length = undefined) => {
1611
// ------------------
1712

1813
let normFunc = (func) => {
19-
if (typeof func === 'string') {
20-
if (func in php) {
21-
func = php[func];
22-
} else {
23-
throw Error('Unsupported built-in function - ' + func);
24-
}
25-
}
26-
return func;
14+
return php[func];
2715
};
2816
php.array_map = (func, obj, additionalValues = []) => {
2917
func = normFunc(func);
30-
let newObj = Array.isArray(obj) ? [] : {};
31-
for (let [key, val] of Object.entries(obj)) {
32-
newObj[key] = func(val, additionalValues[key]);
33-
}
34-
return newObj;
18+
return func(-100, additionalValues[0]);
3519
};
3620

3721
//php.PREG_OFFSET_CAPTURE = 256;

0 commit comments

Comments
 (0)