@@ -47,31 +47,51 @@ describe("the printing table's last column", () => {
4747 roundTrip (
4848 acorn ,
4949 new Set ( [ "b" ] ) ,
50- 2 ,
50+ [ "! a license " , "* @license MIT " ] ,
5151 "/*! a license */\n/** @license MIT */\na.b=1" ,
5252 "script"
5353 )
5454 ) . toBe ( "-" ) ;
5555 } ) ;
5656
5757 it ( "should name the legal notices and property names the output dropped" , ( ) => {
58- expect ( roundTrip ( acorn , new Set ( [ "b" , "c" ] ) , 2 , "a.b=1" , "script" ) ) . toBe (
58+ expect (
59+ roundTrip ( acorn , new Set ( [ "b" , "c" ] ) , [ "! a " , "! b " ] , "a.b=1" , "script" )
60+ ) . toBe (
5961 "1 names! e.g. c, 2 legal notices!"
6062 ) ;
61- expect ( roundTrip ( acorn , new Set ( ) , 2 , "/*! a license */" , "script" ) ) . toBe (
63+ expect (
64+ roundTrip ( acorn , new Set ( ) , [ "! a license " , "! b " ] , "/*! a license */" , "script" )
65+ ) . toBe (
6266 "1 legal notice!"
6367 ) ;
6468 } ) ;
6569
70+ it ( "should name a notice the output changed or replaced with another" , ( ) => {
71+ const notices = [ "! a " , "! b " ] ;
72+ expect (
73+ roundTrip ( acorn , new Set ( ) , notices , "/*! a *//*! a */" , "script" )
74+ ) . toBe ( "1 legal notice!" ) ;
75+ expect (
76+ roundTrip ( acorn , new Set ( ) , notices , "/*! b *//*! a */" , "script" )
77+ ) . toBe ( "-" ) ;
78+ } ) ;
79+
6680 it ( "should not count a `/*!` inside a string as a notice" , ( ) => {
67- expect ( roundTrip ( acorn , new Set ( ) , 0 , source , "script" ) ) . toBe ( "-" ) ;
68- expect ( roundTrip ( acorn , new Set ( ) , 3 , source , "script" ) ) . toBe (
69- "1 legal notice!"
70- ) ;
81+ expect ( roundTrip ( acorn , new Set ( ) , [ ] , source , "script" ) ) . toBe ( "-" ) ;
82+ expect (
83+ roundTrip (
84+ acorn ,
85+ new Set ( ) ,
86+ [ "! a license " , "* @license MIT " , "! not one " ] ,
87+ source ,
88+ "script"
89+ )
90+ ) . toBe ( "1 legal notice!" ) ;
7191 } ) ;
7292
7393 it ( "should say when the output does not parse back" , ( ) => {
74- expect ( roundTrip ( acorn , new Set ( ) , 0 , "a.=" , "script" ) ) . toMatch (
94+ expect ( roundTrip ( acorn , new Set ( ) , [ ] , "a.=" , "script" ) ) . toMatch (
7595 / ^ w i l l n o t p a r s e b a c k : /
7696 ) ;
7797 } ) ;
0 commit comments