Search in sources :

Example 6 with SpecfileSection

use of org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileSection in project linuxtools by eclipse.

the class HeaderRecognitionTest method testGetComplexSectionName4.

@Test
public void testGetComplexSectionName4() {
    // FIXME: check for rest of line when -p is implemented
    // this should be an error case
    String testText = "%post -n name -p";
    String[] tokens = testText.split("\\s+");
    SpecfileElement element;
    newFile(testText);
    element = parser.parseLine(testText, specfile, 0);
    assertEquals(SpecfileSection.class, element.getClass());
    SpecfileSection section = (SpecfileSection) element;
    assertEquals(tokens[0].substring(1), section.getName());
    assertEquals(tokens[2], section.getPackage().getPackageName());
}
Also used : SpecfileSection(org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileSection) SpecfileElement(org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileElement) Test(org.junit.Test)

Example 7 with SpecfileSection

use of org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileSection in project linuxtools by eclipse.

the class HeaderRecognitionTest method testGetComplexSectionName6.

@Test
public void testGetComplexSectionName6() {
    String testText = "%post -p blah bleh";
    // FIXME: check for rest of line when -p is implemented
    // "blah bleh" should become the actual text of the section
    String[] tokens = testText.split("\\s+");
    SpecfileElement element;
    newFile(testText);
    element = parser.parseLine(testText, specfile, 0);
    assertEquals(SpecfileSection.class, element.getClass());
    SpecfileSection section = (SpecfileSection) element;
    assertEquals(tokens[0].substring(1), section.getName());
    assertNull(section.getPackage());
}
Also used : SpecfileSection(org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileSection) SpecfileElement(org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileElement) Test(org.junit.Test)

Aggregations

SpecfileSection (org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileSection)7 SpecfileElement (org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileElement)6 Test (org.junit.Test)5 Specfile (org.eclipse.linuxtools.rpm.ui.editor.parser.Specfile)2 SpecfilePackage (org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfilePackage)2 CoreException (org.eclipse.core.runtime.CoreException)1 BadLocationException (org.eclipse.jface.text.BadLocationException)1 SpecfilePreamble (org.eclipse.linuxtools.internal.rpm.ui.editor.parser.SpecfilePreamble)1 SpecfileErrorHandler (org.eclipse.linuxtools.rpm.ui.editor.markers.SpecfileErrorHandler)1 SpecfileTaskHandler (org.eclipse.linuxtools.rpm.ui.editor.markers.SpecfileTaskHandler)1 SpecfilePackageContainer (org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfilePackageContainer)1 SpecfileParser (org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileParser)1 FileEditorInput (org.eclipse.ui.part.FileEditorInput)1