Skip to content

Commit

Permalink
New NativeFunction tests
Browse files Browse the repository at this point in the history
  • Loading branch information
devsnek committed Jul 26, 2020
1 parent c619375 commit 4e7f377
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 514 deletions.
7 changes: 5 additions & 2 deletions harness/nativeFunctionMatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ info: |
the NativeFunction grammar production without requiring a correct tokeniser.
NativeFunction :
function _IdentifierName_ opt ( _FormalParameters_ ) { [ native code ] }
function _NativeFunctionAccessor_ opt _IdentifierName_ opt ( _FormalParameters_ ) { [ native code ] }
NativeFunctionAccessor :
get
set
defines:
- NATIVE_FUNCTION_RE
- assertToStringOrNativeFunction
- assertNativeFunction
---*/
const NATIVE_FUNCTION_RE = /\bfunction\b[\s\S]*\([\s\S]*\)[\s\S]*\{[\s\S]*\[[\s\S]*\bnative\b[\s\S]+\bcode\b[\s\S]*\][\s\S]*\}/;
const NATIVE_FUNCTION_RE = /\bfunction\b((get|set)\b)?[\s\S]*\([\s\S]*\)[\s\S]*\{[\s\S]*\[[\s\S]*\bnative\b[\s\S]+\bcode\b[\s\S]*\][\s\S]*\}/;

const assertToStringOrNativeFunction = function(fn, expected) {
const actual = "" + fn;
Expand Down
Loading

0 comments on commit 4e7f377

Please sign in to comment.