Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: third_party/closure_compiler/runner/test/com/google/javascript/jscomp/ChromePassTest.java

Issue 543863002: Typecheck chrome://bookmarks using Closure Compiler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@true_master
Patch Set: debug warns Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/closure_compiler/runner/src/com/google/javascript/jscomp/ChromePass.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package com.google.javascript.jscomp; 5 package com.google.javascript.jscomp;
6 6
7 /** 7 /**
8 * Tests {@link ChromePass}. 8 * Tests {@link ChromePass}.
9 */ 9 */
10 public class ChromePassTest extends CompilerTestCase { 10 public class ChromePassTest extends CompilerTestCase {
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 "var namespace = namespace || {};\n" + 185 "var namespace = namespace || {};\n" +
186 "cr.define('namespace', function() {\n" + 186 "cr.define('namespace', function() {\n" +
187 " namespace.a;\n" + 187 " namespace.a;\n" +
188 " var b;\n" + 188 " var b;\n" +
189 " return {\n" + 189 " return {\n" +
190 " a: namespace.a\n" + 190 " a: namespace.a\n" +
191 " };\n" + 191 " };\n" +
192 "});\n"); 192 "});\n");
193 } 193 }
194 194
195 public void testCrDefineDoesNothingWithExportedNotAName() throws Exception {
196 test(
197 "cr.define('namespace', function() {\n" +
198 " return {\n" +
199 " a: 42\n" +
200 " };\n" +
201 "});\n",
202 "var namespace = namespace || {};\n" +
203 "cr.define('namespace', function() {\n" +
204 " return {\n" +
205 " a: 42\n" +
206 " };\n" +
207 "});\n");
208 }
209
210 public void testCrDefineDoesNothingWithExportedNotAName() throws Exception {
211 test(
212 "cr.define('namespace', function() {\n" +
213 " return {\n" +
214 " a: 42\n" +
215 " };\n" +
216 "});\n",
217 "var namespace = namespace || {};\n" +
218 "cr.define('namespace', function() {\n" +
219 " return {\n" +
220 " a: 42\n" +
221 " };\n" +
222 "});\n");
223 }
224
195 public void testCrDefineChangesReferenceToExportedFunction() throws Exceptio n { 225 public void testCrDefineChangesReferenceToExportedFunction() throws Exceptio n {
196 test( 226 test(
197 "cr.define('namespace', function() {\n" + 227 "cr.define('namespace', function() {\n" +
198 " function internalStaticMethod() {\n" + 228 " function internalStaticMethod() {\n" +
199 " alert(42);\n" + 229 " alert(42);\n" +
200 " }\n" + 230 " }\n" +
201 " function letsUseIt() {\n" + 231 " function letsUseIt() {\n" +
202 " internalStaticMethod();\n" + 232 " internalStaticMethod();\n" +
203 " }\n" + 233 " }\n" +
204 " return {\n" + 234 " return {\n" +
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 ChromePass.CR_MAKE_PUBLIC_INVALID_SECOND_ARGUMENT); 549 ChromePass.CR_MAKE_PUBLIC_INVALID_SECOND_ARGUMENT);
520 } 550 }
521 551
522 public void testCrMakePublicReportsInvalidSecondArgumentArrayWithNotAString( ) throws Exception { 552 public void testCrMakePublicReportsInvalidSecondArgumentArrayWithNotAString( ) throws Exception {
523 test( 553 test(
524 "cr.makePublic(Class, [42]);", null, 554 "cr.makePublic(Class, [42]);", null,
525 ChromePass.CR_MAKE_PUBLIC_INVALID_SECOND_ARGUMENT); 555 ChromePass.CR_MAKE_PUBLIC_INVALID_SECOND_ARGUMENT);
526 } 556 }
527 557
528 } 558 }
OLDNEW
« no previous file with comments | « third_party/closure_compiler/runner/src/com/google/javascript/jscomp/ChromePass.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698