@@ -29,51 +29,34 @@ describeBridge('bridge: args_names parser', () => {
2929 } ) ;
3030 } ) ;
3131
32- // The skipped tests below assert how a correct parser should behave.
33- // They are buggy today because both this bridge and the JS-side
34- // schema-compiler use the same regex; a fix must touch both.
35- describe ( 'known bugs (skip = expected behavior after fix)' , ( ) => {
36- // The named-function branch of the regex captures [A-Za-z0-9_,]* —
37- // no whitespace allowed. V8 renders `function f(x, y)` with a space
38- // after the comma, so capture stops after the first arg.
39- it . skip ( 'parses named function declaration with multiple args' , ( ) => {
32+ describe ( 'edge cases' , ( ) => {
33+ it ( 'parses named function declaration with multiple args' , ( ) => {
4034 function named ( x : any , y : any ) {
4135 return [ x , y ] ;
4236 }
4337 expect ( parseArgsNames ( named ) ) . toEqual ( [ 'x' , 'y' ] ) ;
4438 } ) ;
4539
46- it . skip ( 'parses async named function declaration with multiple args' , ( ) => {
40+ it ( 'parses async named function declaration with multiple args' , ( ) => {
4741 async function named ( x : any , y : any ) {
4842 return [ x , y ] ;
4943 }
5044 expect ( parseArgsNames ( named ) ) . toEqual ( [ 'x' , 'y' ] ) ;
5145 } ) ;
5246
53- // Default args land inside the (...) capture as a single token "x = 1"
54- // and survive the comma split unchanged. Special names like
55- // SECURITY_CONTEXT in this position fail to dispatch.
56- it . skip ( 'parses default args, returning just the identifier' , ( ) => {
47+ it ( 'parses default args, returning just the identifier' , ( ) => {
5748 expect ( parseArgsNames ( ( x : any = 1 ) => x ) ) . toEqual ( [ 'x' ] ) ;
5849 } ) ;
5950
60- // Rest args keep their leading dots after capture+split, yielding
61- // "...args" instead of "args".
62- it . skip ( 'parses rest args, dropping the spread dots' , ( ) => {
51+ it ( 'parses rest args, dropping the spread dots' , ( ) => {
6352 expect ( parseArgsNames ( ( ...args : any [ ] ) => args ) ) . toEqual ( [ 'args' ] ) ;
6453 } ) ;
6554
66- // Destructuring patterns get split by the comma inside the braces,
67- // breaking the pattern into half-tokens.
68- it . skip ( 'parses destructuring args, returning the destructured identifiers' , ( ) => {
55+ it ( 'parses destructuring args, returning the destructured identifiers' , ( ) => {
6956 expect ( parseArgsNames ( ( { a, b } : any ) => [ a , b ] ) ) . toEqual ( [ 'a' , 'b' ] ) ;
7057 } ) ;
7158
72- // Anonymous function expressions (`function (x){}`) match no branch
73- // of the regex at all. Today Rust silently returns []; the JS side
74- // throws `Can't match args for: ...`. Neither is the desired
75- // behavior — the parser should just return the args.
76- it . skip ( 'parses anonymous function expressions' , ( ) => {
59+ it ( 'parses anonymous function expressions' , ( ) => {
7760 // eslint-disable-next-line func-names, prefer-arrow-callback
7861 const fn = function ( x : any ) { return x ; } ;
7962 expect ( parseArgsNames ( fn ) ) . toEqual ( [ 'x' ] ) ;
0 commit comments