File tree Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -50,16 +50,35 @@ describe('Test lexer', function() {
50
50
lexer : {
51
51
short_tags : true ,
52
52
asp_tags : true ,
53
- debug : true
53
+ debug : false
54
54
} ,
55
55
parser : {
56
56
extractDoc : true ,
57
- debug : true
57
+ debug : false
58
58
}
59
59
} ) ;
60
60
// @fixme
61
61
ast . children [ 0 ] . kind . should . be . exactly ( 'doc' ) ;
62
- console . log ( ast . children ) ;
62
+ // console.log(ast.children);
63
63
} ) ;
64
64
} ) ;
65
+ it ( 'test tokens' , function ( ) {
66
+ var tokens = parser . tokenGetAll ( '<?php\necho $var;' ) ;
67
+ // test type
68
+ tokens [ 0 ] [ 0 ] . should . be . exactly ( 'T_OPEN_TAG' ) ;
69
+ tokens [ 1 ] [ 0 ] . should . be . exactly ( 'T_ECHO' ) ;
70
+ tokens [ 2 ] [ 0 ] . should . be . exactly ( 'T_WHITESPACE' ) ;
71
+ tokens [ 3 ] [ 0 ] . should . be . exactly ( 'T_VARIABLE' ) ;
72
+ tokens [ 4 ] . should . be . exactly ( ';' ) ;
73
+ // test contents
74
+ tokens [ 0 ] [ 1 ] . should . be . exactly ( '<?php\n' ) ;
75
+ tokens [ 1 ] [ 1 ] . should . be . exactly ( 'echo' ) ;
76
+ tokens [ 2 ] [ 1 ] . should . be . exactly ( ' ' ) ;
77
+ tokens [ 3 ] [ 1 ] . should . be . exactly ( '$var' ) ;
78
+ // test lines
79
+ tokens [ 0 ] [ 2 ] . should . be . exactly ( 1 ) ;
80
+ tokens [ 1 ] [ 2 ] . should . be . exactly ( 2 ) ;
81
+ tokens [ 2 ] [ 2 ] . should . be . exactly ( 2 ) ;
82
+ tokens [ 3 ] [ 2 ] . should . be . exactly ( 2 ) ;
83
+ } ) ;
65
84
} ) ;
You can’t perform that action at this time.
0 commit comments