mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:58:12 +00:00
LibJS: Implement basic for..in and for..of loops
This commit is contained in:
parent
c378a1c730
commit
07af2e6b2c
8 changed files with 372 additions and 90 deletions
|
@ -50,6 +50,13 @@ function assertThrowsError(testFunction, options) {
|
|||
}
|
||||
}
|
||||
|
||||
const assertVisitsAll = (testFunction, expectedOutput) => {
|
||||
const visited = [];
|
||||
testFunction(value => visited.push(value));
|
||||
assert(visited.length === expectedOutput.length);
|
||||
expectedOutput.forEach((value, i) => assert(visited[i] === value));
|
||||
};
|
||||
|
||||
/**
|
||||
* Check whether the difference between two numbers is less than 0.000001.
|
||||
* @param {Number} a First number
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue