@@ -33,7 +33,7 @@ public void missingVersion() throws Exception
3333 + "rules_antlr_dependencies()" ;
3434
3535 TestWorkspace workspace = new TestWorkspace (true );
36- Path file = workspace .file ("WORKSPACE" , contents );
36+ workspace .file ("WORKSPACE" , contents );
3737 Command c = new Command (workspace .root , "//antlr2/Calc/..." ).build ();
3838 assertEquals (c .output (), 1 , c .exitValue ());
3939 assertTrue (c .output ().contains ("attribute versionsAndLanguages: Missing ANTLR version" ));
@@ -51,7 +51,7 @@ public void languageAndMissingVersion() throws Exception
5151 + "rules_antlr_dependencies(\" Java\" )" ;
5252
5353 TestWorkspace workspace = new TestWorkspace (true );
54- Path file = workspace .file ("WORKSPACE" , contents );
54+ workspace .file ("WORKSPACE" , contents );
5555 Command c = new Command (workspace .root , "//antlr2/Calc/..." ).build ();
5656 assertEquals (c .output (), 1 , c .exitValue ());
5757 assertTrue (c .output ().contains ("attribute versionsAndLanguages: Missing ANTLR version" ));
@@ -69,10 +69,23 @@ public void unsupportedVersion() throws Exception
6969 + "rules_antlr_dependencies(\" 4.0\" )" ;
7070
7171 TestWorkspace workspace = new TestWorkspace (true );
72- Path file = workspace .file ("WORKSPACE" , contents );
72+ workspace .file ("WORKSPACE" , contents );
7373 Command c = new Command (workspace .root , "//antlr2/Calc/..." ).build ();
7474 assertEquals (c .output (), 1 , c .exitValue ());
7575 assertTrue (c .output ().contains ("attribute versionsAndLanguages: Unsupported ANTLR version provided: \" 4.0\" ." ));
76+
77+ contents = "workspace(name=\" examples\" )\n "
78+ + "local_repository(\n "
79+ + " name = \" rules_antlr\" ,\n "
80+ + " path = \" ../../../rules_antlr\" ,\n "
81+ + ")\n "
82+ + "load(\" @rules_antlr//antlr:repositories.bzl\" , \" rules_antlr_optimized_dependencies\" )\n "
83+ + "rules_antlr_optimized_dependencies(\" 4.0\" )" ;
84+
85+ workspace .file ("WORKSPACE" , contents );
86+ c = new Command (workspace .root , "//antlr4/HelloWorld/..." ).build ();
87+ assertEquals (c .output (), 1 , c .exitValue ());
88+ assertTrue (c .output ().contains ("attribute version: Unsupported ANTLR version provided: \" 4.0\" ." ));
7689 }
7790
7891 @ Test
@@ -87,10 +100,23 @@ public void invalidVersion() throws Exception
87100 + "rules_antlr_dependencies(471)" ;
88101
89102 TestWorkspace workspace = new TestWorkspace (true );
90- Path file = workspace .file ("WORKSPACE" , contents );
103+ workspace .file ("WORKSPACE" , contents );
91104 Command c = new Command (workspace .root , "//antlr2/Calc/..." ).build ();
92105 assertEquals (c .output (), 1 , c .exitValue ());
93106 assertTrue (c .output ().contains ("attribute versionsAndLanguages: Integer version '471' no longer valid. Use semantic version \" 4.7.1\" instead." ));
107+
108+ contents = "workspace(name=\" examples\" )\n "
109+ + "local_repository(\n "
110+ + " name = \" rules_antlr\" ,\n "
111+ + " path = \" ../../../rules_antlr\" ,\n "
112+ + ")\n "
113+ + "load(\" @rules_antlr//antlr:repositories.bzl\" , \" rules_antlr_optimized_dependencies\" )\n "
114+ + "rules_antlr_optimized_dependencies(471)" ;
115+
116+ workspace .file ("WORKSPACE" , contents );
117+ c = new Command (workspace .root , "//antlr4/HelloWorld/..." ).build ();
118+ assertEquals (c .output (), 1 , c .exitValue ());
119+ assertTrue (c .output ().contains ("attribute version: Integer version '471' no longer valid. Use semantic version \" 4.7.1\" instead." ));
94120 }
95121
96122 @ Test
@@ -105,7 +131,7 @@ public void invalidLanguage() throws Exception
105131 + "rules_antlr_dependencies(4, \" Haskell\" )" ;
106132
107133 TestWorkspace workspace = new TestWorkspace (true );
108- Path file = workspace .file ("WORKSPACE" , contents );
134+ workspace .file ("WORKSPACE" , contents );
109135 Command c = new Command (workspace .root , "//antlr2/Calc/..." ).build ();
110136 assertEquals (c .output (), 1 , c .exitValue ());
111137 assertTrue (c .output ().contains ("attribute versionsAndLanguages: Invalid language provided: \" Haskell\" ." ));
@@ -123,7 +149,7 @@ public void severalVersions() throws Exception
123149 + "rules_antlr_dependencies(\" 4.7.1\" , \" 4.7.2\" )" ;
124150
125151 TestWorkspace workspace = new TestWorkspace (true );
126- Path file = workspace .file ("WORKSPACE" , contents );
152+ workspace .file ("WORKSPACE" , contents );
127153 Command c = new Command (workspace .root , "//antlr2/Calc/..." ).build ();
128154 assertEquals (c .output (), 1 , c .exitValue ());
129155 assertTrue (c .output ().contains ("attribute versionsAndLanguages: You can only load one version from ANTLR 4. You specified both \" 4.7.1\" and \" 4.7.2\" ." ));
@@ -141,7 +167,7 @@ public void missingLanguage() throws Exception
141167 + "rules_antlr_dependencies(\" 2.7.7\" )" ;
142168
143169 TestWorkspace workspace = new TestWorkspace (true );
144- Path file = workspace .file ("WORKSPACE" , contents );
170+ workspace .file ("WORKSPACE" , contents );
145171 Command c = new Command (workspace .root , "//antlr2/Cpp/..." ).build ();
146172 assertEquals (c .output (), 1 , c .exitValue ());
147173 }
@@ -158,7 +184,7 @@ public void alwaysLoadJavaDependencies() throws Exception
158184 + "rules_antlr_dependencies(\" 2.7.7\" , \" Cpp\" )" ;
159185
160186 TestWorkspace workspace = new TestWorkspace (true );
161- Path file = workspace .file ("WORKSPACE" , contents );
187+ workspace .file ("WORKSPACE" , contents );
162188 Command c = new Command (workspace .root , "//antlr2/Cpp/..." ).build ();
163189 assertEquals (c .output (), 0 , c .exitValue ());
164190 }
0 commit comments