use of com.google.javascript.jscomp.modules.ModuleMetadataMap.ModuleMetadata in project closure-compiler by google.
the class GatherModuleMetadataTest method testLegacyGoogModule.
@Test
public void testLegacyGoogModule() {
testSame("goog.module('my.module'); goog.module.declareLegacyNamespace();");
assertThat(metadataMap().getModulesByGoogNamespace().keySet()).containsExactly("my.module");
ModuleMetadata m = metadataMap().getModulesByGoogNamespace().get("my.module");
assertThat(m.googNamespaces()).containsExactly("my.module");
assertThat(m.isGoogProvide()).isFalse();
assertThat(m.isGoogModule()).isTrue();
assertThat(m.isNonLegacyGoogModule()).isFalse();
assertThat(m.isLegacyGoogModule()).isTrue();
}
use of com.google.javascript.jscomp.modules.ModuleMetadataMap.ModuleMetadata in project closure-compiler by google.
the class GatherModuleMetadataTest method testGoogModule.
@Test
public void testGoogModule() {
testSame("goog.module('my.module');");
assertThat(metadataMap().getModulesByGoogNamespace().keySet()).containsExactly("my.module");
ModuleMetadata m = metadataMap().getModulesByGoogNamespace().get("my.module");
assertThat(m.googNamespaces()).containsExactly("my.module");
assertThat(m.isGoogProvide()).isFalse();
assertThat(m.isGoogModule()).isTrue();
assertThat(m.isNonLegacyGoogModule()).isTrue();
assertThat(m.isLegacyGoogModule()).isFalse();
}
use of com.google.javascript.jscomp.modules.ModuleMetadataMap.ModuleMetadata in project closure-compiler by google.
the class GatherModuleMetadataTest method testLocalGoogIsNotClosure.
@Test
public void testLocalGoogIsNotClosure() {
testSame("function bar() { var goog; goog.isArray(foo); }");
ModuleMetadata m = metadataMap().getModulesByPath().get("testcode");
assertThat(m.usesClosure()).isFalse();
}
use of com.google.javascript.jscomp.modules.ModuleMetadataMap.ModuleMetadata in project closure-compiler by google.
the class GatherModuleMetadataTest method testEs6ModuleDeclareModuleId.
@Test
public void testEs6ModuleDeclareModuleId() {
testSame("export var x; goog.declareModuleId('my.module');");
assertThat(metadataMap().getModulesByGoogNamespace().keySet()).containsExactly("my.module");
ModuleMetadata m = metadataMap().getModulesByGoogNamespace().get("my.module");
assertThat(m.googNamespaces()).containsExactly("my.module");
assertThat(m.isEs6Module()).isTrue();
assertThat(m.isGoogModule()).isFalse();
}
use of com.google.javascript.jscomp.modules.ModuleMetadataMap.ModuleMetadata in project closure-compiler by google.
the class GatherModuleMetadataTest method testImportOrder.
@Test
public void testImportOrder() {
testSame("import 'first'; export { name } from 'second'; import 'third';");
ModuleMetadata m = metadataMap().getModulesByPath().get("testcode");
assertThat(m.es6ImportSpecifiers()).containsExactly("first", "second", "third");
}
Aggregations