use of com.google.javascript.jscomp.modules.ModuleMetadataMap.ModuleMetadata in project closure-compiler by google.
the class GatherModuleMetadataTest method testMultipleGoogLoadModules.
@Test
public void testMultipleGoogLoadModules() {
testSame(lines("goog.loadModule(function(exports) {", " goog.module('multiple.calls.c0');", " return exports;", "});", "", "goog.loadModule(function(exports) {", " goog.module('multiple.calls.c1');", " return exports;", "});"));
assertThat(metadataMap().getModulesByGoogNamespace().keySet()).containsExactly("multiple.calls.c0", "multiple.calls.c1");
ModuleMetadata m = metadataMap().getModulesByGoogNamespace().get("multiple.calls.c0");
assertThat(m.googNamespaces()).containsExactly("multiple.calls.c0");
assertThat(m.isNonLegacyGoogModule()).isTrue();
assertThat(m.path()).isNull();
m = metadataMap().getModulesByGoogNamespace().get("multiple.calls.c1");
assertThat(m.googNamespaces()).containsExactly("multiple.calls.c1");
assertThat(m.isNonLegacyGoogModule()).isTrue();
assertThat(m.path()).isNull();
m = metadataMap().getModulesByPath().get("testcode");
assertThat(m.googNamespaces()).isEmpty();
assertThat(m.isNonProvideScript()).isTrue();
}
use of com.google.javascript.jscomp.modules.ModuleMetadataMap.ModuleMetadata in project closure-compiler by google.
the class GatherModuleMetadataTest method testSetTestOnlyWithExtraArg.
@Test
public void testSetTestOnlyWithExtraArg() {
testError("goog.setTestOnly('string', 'string');", GatherModuleMetadata.INVALID_SET_TEST_ONLY);
ModuleMetadata m = metadataMap().getModulesByPath().get("testcode");
assertThat(m.isTestOnly()).isFalse();
}
use of com.google.javascript.jscomp.modules.ModuleMetadataMap.ModuleMetadata in project closure-compiler by google.
the class GatherModuleMetadataTest method testEs6Module.
@Test
public void testEs6Module() {
testSame("export var x;");
assertThat(metadataMap().getModulesByGoogNamespace().keySet()).isEmpty();
assertThat(metadataMap().getModulesByPath().keySet()).contains("testcode");
ModuleMetadata m = metadataMap().getModulesByPath().get("testcode");
assertThat(m.googNamespaces()).isEmpty();
assertThat(m.isEs6Module()).isTrue();
}
use of com.google.javascript.jscomp.modules.ModuleMetadataMap.ModuleMetadata in project closure-compiler by google.
the class GatherModuleMetadataTest method testUsesGlobalClosure.
@Test
public void testUsesGlobalClosure() {
testSame("goog.isArray(foo);");
ModuleMetadata m = metadataMap().getModulesByPath().get("testcode");
assertThat(m.usesClosure()).isTrue();
}
use of com.google.javascript.jscomp.modules.ModuleMetadataMap.ModuleMetadata in project closure-compiler by google.
the class GatherModuleMetadataTest method testCommonJsModule.
@Test
public void testCommonJsModule() {
testSame("exports = 0;");
assertThat(metadataMap().getModulesByGoogNamespace()).isEmpty();
ModuleMetadata m = metadataMap().getModulesByPath().get("testcode");
assertThat(m.isCommonJs()).isTrue();
}
Aggregations