Search in sources :

Example 16 with ExclusiveRange

use of org.eclipse.xtext.xbase.lib.ExclusiveRange in project xtext-core by eclipse.

the class DefaultTaskParserTest method assertContainsTasks.

private void assertContainsTasks(final CharSequence source, final List<Task> expectedTasks) {
    final List<Task> actualTasks = this.parser.parseTasks(LineDelimiters.toUnix(source.toString()), this.definitions);
    Assert.assertEquals(expectedTasks.size(), actualTasks.size());
    int _size = expectedTasks.size();
    ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size, true);
    for (final Integer i : _doubleDotLessThan) {
        TaskAssert.assertExactMatch(expectedTasks.get((i).intValue()), actualTasks.get((i).intValue()));
    }
}
Also used : Task(org.eclipse.xtext.tasks.Task) ExclusiveRange(org.eclipse.xtext.xbase.lib.ExclusiveRange)

Example 17 with ExclusiveRange

use of org.eclipse.xtext.xbase.lib.ExclusiveRange in project xtext-core by eclipse.

the class PreferenceTaskTagProviderTest method test.

@Test
public void test() {
    TaskTag _taskTag = new TaskTag();
    final Procedure1<TaskTag> _function = (TaskTag it) -> {
        it.setName("Foo");
        it.setPriority(Priority.LOW);
    };
    TaskTag _doubleArrow = ObjectExtensions.<TaskTag>operator_doubleArrow(_taskTag, _function);
    TaskTag _taskTag_1 = new TaskTag();
    final Procedure1<TaskTag> _function_1 = (TaskTag it) -> {
        it.setName("BAR");
        it.setPriority(Priority.NORMAL);
    };
    TaskTag _doubleArrow_1 = ObjectExtensions.<TaskTag>operator_doubleArrow(_taskTag_1, _function_1);
    TaskTag _taskTag_2 = new TaskTag();
    final Procedure1<TaskTag> _function_2 = (TaskTag it) -> {
        it.setName("baZ");
        it.setPriority(Priority.HIGH);
    };
    TaskTag _doubleArrow_2 = ObjectExtensions.<TaskTag>operator_doubleArrow(_taskTag_2, _function_2);
    final List<TaskTag> tags = Collections.<TaskTag>unmodifiableList(CollectionLiterals.<TaskTag>newArrayList(_doubleArrow, _doubleArrow_1, _doubleArrow_2));
    final String names = PreferenceTaskTagProvider.serializeTags(tags);
    final String prios = PreferenceTaskTagProvider.serializePriorities(tags);
    final IPreferenceValuesProvider.SingletonPreferenceValuesProvider valueProvider = new IPreferenceValuesProvider.SingletonPreferenceValuesProvider();
    final MapBasedPreferenceValues values = valueProvider.getPreferenceValues(null);
    values.put(PreferenceTaskTagProvider.TAGS_KEY.getId(), names);
    values.put(PreferenceTaskTagProvider.PRIORITIES_KEY.getId(), prios);
    values.put(PreferenceTaskTagProvider.CASE_SENSITIVE_KEY.getId(), "false");
    final PreferenceTaskTagProvider tagProvider = new PreferenceTaskTagProvider();
    tagProvider.setPreferenceValuesProvider(valueProvider);
    final TaskTags parsedTags = tagProvider.getTaskTags(null);
    Assert.assertEquals(Boolean.valueOf(false), Boolean.valueOf(parsedTags.isCaseSensitive()));
    Assert.assertEquals(tags.size(), IterableExtensions.size(parsedTags));
    int _size = tags.size();
    ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size, true);
    for (final Integer i : _doubleDotLessThan) {
        TaskAssert.assertExactMatch(tags.get((i).intValue()), ((TaskTag[]) Conversions.unwrapArray(parsedTags, TaskTag.class))[(i).intValue()]);
    }
}
Also used : TaskTag(org.eclipse.xtext.tasks.TaskTag) MapBasedPreferenceValues(org.eclipse.xtext.preferences.MapBasedPreferenceValues) ExclusiveRange(org.eclipse.xtext.xbase.lib.ExclusiveRange) IPreferenceValuesProvider(org.eclipse.xtext.preferences.IPreferenceValuesProvider) PreferenceTaskTagProvider(org.eclipse.xtext.tasks.PreferenceTaskTagProvider) TaskTags(org.eclipse.xtext.tasks.TaskTags) Test(org.junit.Test)

Aggregations

ExclusiveRange (org.eclipse.xtext.xbase.lib.ExclusiveRange)17 Task (org.eclipse.xtext.tasks.Task)4 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)3 Test (org.junit.Test)3 ArrayList (java.util.ArrayList)2 TypeReference (org.eclipse.xtend.lib.macro.declaration.TypeReference)2 SerializableEObjectDescription (org.eclipse.xtext.resource.persistence.SerializableEObjectDescription)2 SerializableReferenceDescription (org.eclipse.xtext.resource.persistence.SerializableReferenceDescription)2 TaskTag (org.eclipse.xtext.tasks.TaskTag)2 LightweightTypeReference (org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference)2 Splitter (com.google.common.base.Splitter)1 HashSet (java.util.HashSet)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 URI (org.eclipse.emf.common.util.URI)1 EObject (org.eclipse.emf.ecore.EObject)1 WidgetNotFoundException (org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException)1 ResolvedParameterImpl (org.eclipse.xtend.core.macro.declaration.ResolvedParameterImpl)1 AbstractParameterBuilder (org.eclipse.xtend.ide.codebuilder.AbstractParameterBuilder)1 VariableNameAcceptor (org.eclipse.xtend.ide.codebuilder.VariableNameAcceptor)1 AnnotationReference (org.eclipse.xtend.lib.macro.declaration.AnnotationReference)1