@@ -47,6 +47,24 @@ int main()
4747` ;
4848// -------------------------------------------------------------------------------
4949
50+
51+ const htmlcode = `
52+ <html>
53+ <header><title>This is title</title></header>
54+ <body>
55+ <!--/ [marker0] -->
56+ Hello world
57+ <!--/ [marker1] -->
58+ Hola Mundo
59+ <!--! [marker1] -->
60+ <!--/ [marker2] -->
61+ Hallo Welt
62+ <!--! [marker2] -->
63+ <!--! [marker0] -->
64+ </body>
65+ </html>
66+ ` ;
67+
5068// Expected results.
5169const expectedMarker0 = ` int a;
5270 //! [marker1]
@@ -64,6 +82,18 @@ const expectedMarker5 = " int g;";
6482const expectedMarker6 = " int h;" ;
6583const expectedMarker7 = " int i;" ;
6684
85+ // Expected HTML results.
86+ const expectedHTMLMarker0 = ` Hello world
87+ <!--/ [marker1] -->
88+ Hola Mundo
89+ <!--! [marker1] -->
90+ <!--/ [marker2] -->
91+ Hallo Welt
92+ <!--! [marker2] -->` ;
93+
94+ const expectedHTMLMarker1 = " Hola Mundo" ;
95+
96+ const expectedHTMLMarker2 = " Hallo Welt" ;
6797
6898describe ( "marker" , function ( ) {
6999 describe ( "#hasMarker" , function ( ) {
@@ -115,6 +145,21 @@ describe("marker", function () {
115145 const result = markerSliceCode ( cppcode , markerName ) ;
116146 assert . equal ( result , expectedMarker4 ) ;
117147 } ) ;
148+ it ( "should slice code between [marker0] with HTML comment <!-- -->" , function ( ) {
149+ const markerName = "marker0" ;
150+ const result = markerSliceCode ( htmlcode , markerName ) ;
151+ assert . equal ( result , expectedHTMLMarker0 ) ;
152+ } ) ;
153+ it ( "should slice code between [marker1] with HTML comment <!-- -->" , function ( ) {
154+ const markerName = "marker1" ;
155+ const result = markerSliceCode ( htmlcode , markerName ) ;
156+ assert . equal ( result , expectedHTMLMarker1 ) ;
157+ } ) ;
158+ it ( "should slice code between [marker2] with HTML comment <!-- -->" , function ( ) {
159+ const markerName = "marker2" ;
160+ const result = markerSliceCode ( htmlcode , markerName ) ;
161+ assert . equal ( result , expectedHTMLMarker2 ) ;
162+ } ) ;
118163 } ) ;
119164 context ( "#comment-style" , function ( ) {
120165 it ( "should slice code between [marker 5]" , function ( ) {
0 commit comments