Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/org.eclipse.xtend.backend.test/src/org/eclipse/xtend/backend/expr/PropertyOnCollectionExpressionTest.java')
-rw-r--r--tests/org.eclipse.xtend.backend.test/src/org/eclipse/xtend/backend/expr/PropertyOnCollectionExpressionTest.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/org.eclipse.xtend.backend.test/src/org/eclipse/xtend/backend/expr/PropertyOnCollectionExpressionTest.java b/tests/org.eclipse.xtend.backend.test/src/org/eclipse/xtend/backend/expr/PropertyOnCollectionExpressionTest.java
new file mode 100644
index 00000000..8365bed3
--- /dev/null
+++ b/tests/org.eclipse.xtend.backend.test/src/org/eclipse/xtend/backend/expr/PropertyOnCollectionExpressionTest.java
@@ -0,0 +1,33 @@
+/*
+Copyright (c) 2008 Arno Haase.
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+ Arno Haase - initial API and implementation
+ */
+package org.eclipse.xtend.backend.expr;
+
+import static org.eclipse.xtend.backend.helpers.BackendTestHelper.SOURCE_POS;
+import static org.eclipse.xtend.backend.helpers.BackendTestHelper.createEmptyExecutionContext;
+import static org.eclipse.xtend.backend.helpers.BackendTestHelper.createLiteral;
+import static org.junit.Assert.assertEquals;
+
+import java.util.Arrays;
+
+import org.eclipse.xtend.backend.helpers.BeanWithSizeProperty;
+import org.junit.Test;
+
+
+/**
+ *
+ * @author Arno Haase (http://www.haase-consulting.com)
+ */
+public class PropertyOnCollectionExpressionTest {
+ @Test public void testLogic () {
+ assertEquals (Arrays.asList (1L, 2L, 3L), new PropertyOnCollectionExpression (createLiteral (Arrays.asList ("a", "ab", "abc")), "length", SOURCE_POS).evaluate (createEmptyExecutionContext()));
+ assertEquals (Arrays.asList (7L, 12L), new PropertyOnCollectionExpression (createLiteral (Arrays.asList (new BeanWithSizeProperty (7), new BeanWithSizeProperty (12))), "size", SOURCE_POS).evaluate (createEmptyExecutionContext()));
+ }
+}

Back to the top