1
0
Fork 0

Keywords are now returned by propParse

closure/master
Mike Gerwitz 2011-01-17 22:24:02 -05:00
parent 1f661bebcd
commit 7dab5c7b20
2 changed files with 48 additions and 2 deletions

View File

@ -239,13 +239,14 @@ exports.propParse = function( data, options )
callbackMethod, callbackMethod,
name, name,
value, value,
exports.isAbstractMethod( value ) exports.isAbstractMethod( value ),
keywords
); );
} }
// simple property // simple property
else else
{ {
callbackProp.call( callbackProp, name, value ); callbackProp.call( callbackProp, name, value, keywords );
} }
} }
}; };

View File

@ -122,3 +122,48 @@ var common = require( './common' ),
}, Error, "Custom keyword parser tolerates bogus response" ); }, Error, "Custom keyword parser tolerates bogus response" );
} )(); } )();
( function testParserReturnsKeywords()
{
var data = {
'public foo': '',
'const foo2': '',
'public bogus keywords foo3': '',
'public static final method': function() {},
},
parsed_keywords = {},
expected = {
foo: { 'public': true },
foo2: { 'const': true },
foo3: { 'public': true, 'bogus': true, 'keywords': true },
method: { 'public': true, 'static': true, 'final': true },
}
;
util.propParse( data, {
property: function( name, value, keywords )
{
parsed_keywords[ name ] = keywords;
},
method: function( name, func, is_abstract, keywords )
{
parsed_keywords[ name ] = keywords;
},
} );
for ( prop in parsed_keywords )
{
assert.deepEqual(
parsed_keywords[ prop ],
expected[ prop ],
"Keywords are properly recognized and made available for " +
"interpretation"
);
}
} )();