@@ -90,7 +90,6 @@ let codes = [
9090 [ "# foo" , "sh" ] ,
9191 [ "# foo" , "tcl" ] ,
9292 [ "<!-- foo-->" , "vue-html" ] ,
93- [ "* foo" , "abap" ] ,
9493 [ "; foo" , "beancount" ] ,
9594 [ "' foo" , "vb" ] ,
9695 [ "<!-- foo-->" , "html" ] ,
@@ -126,12 +125,10 @@ let codes = [
126125 // ["// foo", "apl"],
127126 // ["# foo", "shellsession"],
128127 // ["(* foo *)", "ocaml"],
129- ] ;
130128
131- // codes = [
132- // // test
133- // ["// foo", "actionscript-3"],
134- // ];
129+ // fails indented
130+ // ["* foo", "abap"],
131+ ] ;
135132
136133describe . each ( codes ) ( "extract annotations" , ( code , lang ) => {
137134 test ( lang , async ( ) => {
@@ -167,5 +164,21 @@ describe.each(codes)("extract annotations", (code, lang) => {
167164
168165 expect ( comments ) . toHaveLength ( 1 ) ;
169166 expect ( comments [ 0 ] ) . toBe ( " foo" ) ;
167+ expect ( extracted . code ) . toBe ( code ) ;
168+ } ) ;
169+ } ) ;
170+
171+ describe . each ( codes ) ( "extract indented annotations" , ( code , lang ) => {
172+ test ( lang , async ( ) => {
173+ let comments = [ ] ;
174+ const c = " " + code ;
175+ const extracted = await extractAnnotations ( c , lang , ( comment ) => {
176+ comments . push ( comment ) ;
177+ return null ;
178+ } ) ;
179+
180+ expect ( comments ) . toHaveLength ( 1 ) ;
181+ expect ( comments [ 0 ] ) . toBe ( " foo" ) ;
182+ expect ( extracted . code ) . toBe ( c ) ;
170183 } ) ;
171184} ) ;
0 commit comments