@@ -27,7 +27,7 @@ describe('transpile to dart', function(){
2727 "var s1:string = \"${a}\";" +
2828 "var s2:string = '\\${a}';" +
2929 "var s3:string = '$a';" ) ;
30- expect ( result . js ) . toBe ( "library test_dart ;\n" +
30+ expect ( result . js ) . toBe ( "library test ;\n" +
3131 "num a = 1;\n" +
3232 "String s1 = \"\\${a}\";\n" +
3333 "String s2 = '\\${a}';\n" +
@@ -39,7 +39,7 @@ describe('transpile to dart', function(){
3939 "var a:number = 1;" +
4040 "var s1:string = `$a`;" +
4141 "var s2:string = `\\$a`;" ) ;
42- expect ( result . js ) . toBe ( "library test_dart ;\n" +
42+ expect ( result . js ) . toBe ( "library test ;\n" +
4343 "num a = 1;\n" +
4444 "String s1 = '''\\$a''';\n" +
4545 "String s2 = '''\\$a''';\n" ) ;
@@ -49,7 +49,7 @@ describe('transpile to dart', function(){
4949 var result = compiler . compile ( options , "test.js" ,
5050 "var a:number = 1;" +
5151 "var s1:string = `${a}`;" ) ;
52- expect ( result . js ) . toBe ( "library test_dart ;\n" +
52+ expect ( result . js ) . toBe ( "library test ;\n" +
5353 "num a = 1;\n" +
5454 "String s1 = '''${a}''';\n" ) ;
5555 } ) ;
@@ -60,25 +60,31 @@ describe('transpile to dart', function(){
6060 it ( 'should support types without generics' , function ( ) {
6161 var result = compiler . compile ( options , "test.js" ,
6262 "var a:List = [];" ) ;
63- expect ( result . js ) . toBe ( "library test_dart ;\nList a = [];\n" ) ;
63+ expect ( result . js ) . toBe ( "library test ;\nList a = [];\n" ) ;
6464 } ) ;
6565
6666 it ( 'should support one level generics' , function ( ) {
6767 var result = compiler . compile ( options , "test.js" ,
6868 "var a:List<string> = [];" ) ;
69- expect ( result . js ) . toBe ( "library test_dart ;\nList<String> a = [];\n" ) ;
69+ expect ( result . js ) . toBe ( "library test ;\nList<String> a = [];\n" ) ;
7070 } ) ;
7171
7272 it ( 'should support multiple one level generics' , function ( ) {
7373 var result = compiler . compile ( options , "test.js" ,
7474 "var a:List<A,B> = [];" ) ;
75- expect ( result . js ) . toBe ( "library test_dart ;\nList<A, B> a = [];\n" ) ;
75+ expect ( result . js ) . toBe ( "library test ;\nList<A, B> a = [];\n" ) ;
7676 } ) ;
7777
7878 it ( 'should support nested generics' , function ( ) {
7979 var result = compiler . compile ( options , "test.js" ,
8080 "var a:List<A<B>> = [];" ) ;
81- expect ( result . js ) . toBe ( "library test_dart;\nList<A<B>> a = [];\n" ) ;
81+ expect ( result . js ) . toBe ( "library test;\nList<A<B>> a = [];\n" ) ;
82+ } ) ;
83+
84+ it ( 'should add dart suffix to reserved words' , function ( ) {
85+ var result = compiler . compile ( options , "project/if.js" ,
86+ "var a;" ) ;
87+ expect ( result . js ) . toBe ( "library project.if_dart;\nvar a;\n" ) ;
8288 } ) ;
8389 } ) ;
8490} ) ;
0 commit comments