This repository has been archived by the owner on Oct 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chakrashim: Fixed multiple unittest bugs
* There was a bug in SetCallback/DeleteCallback where we were not returning a boolean value that set/delete traps expect. This fixes below 3 unittest failures. ` parallel/test-fs-readfile-error sequential/test-stdin-script-child sequential/test-util-debug ` * While working on `parallel/test-util` realized that we don't behave correctly for following: ```javascript utils.isRegExp(Object.create(RegExp.prototype)); ``` Above code should fail because object returned from `Object.create()` is a normal object whose prototype is `RegExp` which is different than actual RegExp object. `utils.isRegExp()` checks if value is actual RegExp. We implemented by calling `instanceof ` operator that passes because the prototype of RegExp and value (which is Object) matches. This is problem for other data types like Date, Array, etc. [This](http://web.mit.edu/jwalden/www/isArray.html) is a good article that explains how we should do such checks correctly. I implemented all of our is*() functions in `chakra_shim.js` instead of `instanceof` operator we had earlier. The implementation is basically : ``` javascript Object.prototype.toString.call(obj) === "[object RegExp]" ``` I have also moved all of the existing Is* methods Also while working on this, I realized that there was lot of duplicate code getting added, so I wrote bunch of MACROS to refactored the code for better readability. This fixes unit test - `parallel/test-util` Reviewed-By : @jianchun
- Loading branch information
1 parent
ee68330
commit 6c70170
Showing
11 changed files
with
188 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.