use of org.jetbrains.lang.manifest.psi.ManifestFile in project intellij-community by JetBrains.
the class ManifestPsiTest method testHeader.
public void testHeader() {
ManifestFile file = createFile("Header: value\nEmpty-Header:\nBad-Header\n");
assertHeaderValue(file, "Header", "value");
assertHeaderValue(file, "Empty-Header", "");
assertHeaderValue(file, "Bad-Header", null);
}
use of org.jetbrains.lang.manifest.psi.ManifestFile in project intellij-plugins by JetBrains.
the class OsgiManifestPsiTest method testAttributes.
public void testAttributes() {
ManifestFile file = createFile("Import-Package: com.acme;a1=value1;a2=value2");
assertAssignment(file, true, "a1", "value1");
assertAssignment(file, true, "a2", "value2");
assertAssignment(file, true, "a3", null);
assertAssignment(file, false, "a1", null);
}
use of org.jetbrains.lang.manifest.psi.ManifestFile in project intellij-plugins by JetBrains.
the class OsgiManifestPsiTest method testDirectives.
public void testDirectives() {
ManifestFile file = createFile("Import-Package: com.acme;d1:=value1;d2:=value2");
assertAssignment(file, false, "d1", "value1");
assertAssignment(file, false, "d2", "value2");
assertAssignment(file, false, "d3", null);
assertAssignment(file, true, "d1", null);
}
use of org.jetbrains.lang.manifest.psi.ManifestFile in project intellij-plugins by JetBrains.
the class OsgiManifestPsiTest method testBundleVersion.
public void testBundleVersion() {
ManifestFile file = createFile("Bundle-Version: 1.2.3.b300\n");
Header header = file.getHeader("Bundle-Version");
assertNotNull(header);
Object value = HeaderParserRepository.getInstance().getConvertedValue(header);
assertEquals(new Version(1, 2, 3, "b300"), value);
}
use of org.jetbrains.lang.manifest.psi.ManifestFile in project intellij-plugins by JetBrains.
the class OsgiManifestPsiTest method testClauses.
public void testClauses() {
ManifestFile file = createFile("Import-Package: a.b,c.d;a=value;d:=value");
Header header = file.getHeader("Import-Package");
assertNotNull(header);
List<HeaderValue> clauses = header.getHeaderValues();
assertEquals(2, clauses.size());
Clause clause1 = (Clause) clauses.get(0), clause2 = (Clause) clauses.get(1);
assertEquals(0, clause1.getAttributes().size());
assertEquals(0, clause1.getDirectives().size());
assertEquals(1, clause2.getAttributes().size());
assertEquals(1, clause2.getDirectives().size());
assertNotNull(clause2.getAttribute("a"));
assertNull(clause2.getAttribute("b"));
assertNotNull(clause2.getDirective("d"));
assertNull(clause2.getDirective("z"));
}
Aggregations