File tree Expand file tree Collapse file tree 2 files changed +27
-5
lines changed
rhino_modules/jsdoc/tag/type
test/specs/jsdoc/tag/type Expand file tree Collapse file tree 2 files changed +27
-5
lines changed Original file line number Diff line number Diff line change @@ -49,12 +49,12 @@ function parseVariable(type) {
49
49
*/
50
50
exports . parse = function ( tagInfo ) {
51
51
var optional = parseOptional ( tagInfo . type ) ,
52
- nullable = parseNullable ( tagInfo . type ) ,
53
- variable = parseVariable ( tagInfo . type ) ;
52
+ nullable = parseNullable ( optional . type ) ,
53
+ variable = parseVariable ( nullable . type ) ;
54
54
55
55
return {
56
56
name : tagInfo . name ,
57
- type : variable . type || nullable . type || optional . type ,
57
+ type : variable . type ,
58
58
text : tagInfo . text ,
59
59
optional : tagInfo . optional || optional . optional , // don't override if already true
60
60
nullable : nullable . nullable ,
Original file line number Diff line number Diff line change 1
- describe ( "jsdoc/tag/type/closureCompilerType" , function ( ) {
2
- //TODO
1
+ /*global describe: true, expect: true, it: true */
2
+ describe ( 'jsdoc/tag/type/closureCompilerType' , function ( ) {
3
+ // TODO: more tests
4
+
5
+ var type = require ( 'jsdoc/tag/type/closureCompilerType' ) ;
6
+
7
+ it ( 'should exist' , function ( ) {
8
+ expect ( type ) . toBeDefined ( ) ;
9
+ expect ( typeof type ) . toEqual ( 'object' ) ;
10
+ } ) ;
11
+
12
+ it ( 'should export a parse function' , function ( ) {
13
+ expect ( type . parse ) . toBeDefined ( ) ;
14
+ expect ( typeof type . parse ) . toEqual ( 'function' ) ;
15
+ } ) ;
16
+
17
+ describe ( 'parse' , function ( ) {
18
+ it ( 'should correctly parse types that are both optional and nullable' , function ( ) {
19
+ var info = type . parse ( { type : '?string=' } ) ;
20
+ expect ( info . type ) . toEqual ( 'string' ) ;
21
+ expect ( info . optional ) . toEqual ( true ) ;
22
+ expect ( info . nullable ) . toEqual ( true ) ;
23
+ } ) ;
24
+ } ) ;
3
25
} ) ;
You can’t perform that action at this time.
0 commit comments