use of com.google.javascript.jscomp.modules.ModuleMetadataMap.ModuleMetadata in project closure-compiler by google.
the class GatherModuleMetadataTest method testSetTestOnlyWithStringArg.
@Test
public void testSetTestOnlyWithStringArg() {
testSame("goog.setTestOnly('string');");
ModuleMetadata m = metadataMap().getModulesByPath().get("testcode");
assertThat(m.isTestOnly()).isTrue();
}
use of com.google.javascript.jscomp.modules.ModuleMetadataMap.ModuleMetadata in project closure-compiler by google.
the class GatherModuleMetadataTest method testImport.
@Test
public void testImport() {
testSame("import '@spec!';");
ModuleMetadata m = metadataMap().getModulesByPath().get("testcode");
assertThat(m.es6ImportSpecifiers()).containsExactly("@spec!");
}
use of com.google.javascript.jscomp.modules.ModuleMetadataMap.ModuleMetadata in project closure-compiler by google.
the class GatherModuleMetadataTest method testImportedGoogIsClosure.
@Test
public void testImportedGoogIsClosure() {
testSame("import * as goog from '/goog.js'; 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 testGoogInSameScriptGoogIsNotClosure.
@Test
public void testGoogInSameScriptGoogIsNotClosure() {
testSame("/** @provideGoog */ 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 testEs6ModuleDeclareModuleIdImportedGoog.
@Test
public void testEs6ModuleDeclareModuleIdImportedGoog() {
testSame(srcs(SourceFile.fromCode("goog.js", ""), SourceFile.fromCode("testcode", lines("import * as goog from './goog.js';", "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();
}
Aggregations