Index: third_party/closure_compiler/runner/test/com/google/javascript/jscomp/ChromePassTest.java |
diff --git a/third_party/closure_compiler/runner/test/com/google/javascript/jscomp/ChromePassTest.java b/third_party/closure_compiler/runner/test/com/google/javascript/jscomp/ChromePassTest.java |
index b8db07d9b2f19f9d739cb76339ca3cd6f1c3c900..267b509d86167789cb7ce35fc23451e572b94a35 100644 |
--- a/third_party/closure_compiler/runner/test/com/google/javascript/jscomp/ChromePassTest.java |
+++ b/third_party/closure_compiler/runner/test/com/google/javascript/jscomp/ChromePassTest.java |
@@ -76,7 +76,7 @@ public class ChromePassTest extends CompilerTestCase { |
"});"); |
} |
- public void testCrDefineReassignsExportedFunctionByQualifiedName() throws Exception { |
+ public void testCrDefineReassignsExportedVarByQualifiedName() throws Exception { |
test( |
"cr.define('namespace', function() {\n" + |
" var internalStaticMethod = function() {\n" + |
@@ -97,6 +97,42 @@ public class ChromePassTest extends CompilerTestCase { |
"});"); |
} |
+ public void testCrDefineExportsVarsWithoutAssignment() throws Exception { |
+ test( |
+ "cr.define('namespace', function() {\n" + |
+ " var a;" + |
+ " return {\n" + |
+ " a: a\n" + |
+ " };\n" + |
+ "});\n", |
Tyler Breisacher (Chromium)
2014/08/18 16:51:00
You're already using Guava elsewhere so you should
Dan Beam
2014/08/19 21:14:19
where are we using Guava? could we avoid adding n
Tyler Breisacher (Chromium)
2014/08/19 21:19:47
https://code.google.com/p/chromium/codesearch#chro
Dan Beam
2014/08/19 21:42:09
i assume that works because of:
https://code.googl
|
+ "var namespace = namespace || {};\n" + |
+ "cr.define('namespace', function() {\n" + |
+ " namespace.a;\n" + |
+ " return {\n" + |
+ " a: namespace.a\n" + |
+ " };\n" + |
+ "});\n"); |
+ } |
+ |
+ public void testCrDefineExportsVarsWithoutAssignmentWithJSDoc() throws Exception { |
+ test( |
+ "cr.define('namespace', function() {\n" + |
+ " /** @type {number} */\n" + |
+ " var a;" + |
Dan Beam
2014/08/18 18:36:46
so is this only change from a => namespace.a in th
Dan Beam
2014/08/18 18:57:45
said in another way
cr.define('ui', function()
|
+ " return {\n" + |
+ " a: a\n" + |
+ " };\n" + |
+ "});\n", |
+ "var namespace = namespace || {};\n" + |
+ "cr.define('namespace', function() {\n" + |
+ " /** @type {number} */\n" + |
+ " namespace.a;\n" + |
+ " return {\n" + |
+ " a: namespace.a\n" + |
+ " };\n" + |
+ "});\n"); |
+ } |
+ |
public void testCrDefineCopiesJSDocForExportedVariable() throws Exception { |
test( |
"cr.define('namespace', function() {\n" + |