aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-04-04 22:27:50 +0100
committerMichael Williamson <mike@zwobble.org>2016-04-04 22:27:50 +0100
commit449c10917348eee52c2d769eb5f6fb7f8ec836b9 (patch)
treef4ecf3fc39c6bf49c6cacf51896191a158a5dc7d /src
parent7e3abc416be5466c89df826ab3db4887acf96bc9 (diff)
Add WIP test for generic methods
Diffstat (limited to 'src')
-rw-r--r--src/test/java/org/zwobble/couscous/tests/CompilerTests.java14
-rw-r--r--src/test/resources/java/generic-method/com/example/GenericMethod.java11
2 files changed, 25 insertions, 0 deletions
diff --git a/src/test/java/org/zwobble/couscous/tests/CompilerTests.java b/src/test/java/org/zwobble/couscous/tests/CompilerTests.java
index 7a60821..cbf4fb5 100644
--- a/src/test/java/org/zwobble/couscous/tests/CompilerTests.java
+++ b/src/test/java/org/zwobble/couscous/tests/CompilerTests.java
@@ -1,5 +1,6 @@
package org.zwobble.couscous.tests;
+import org.junit.Ignore;
import org.junit.Test;
import org.zwobble.couscous.types.ScalarType;
import org.zwobble.couscous.types.Types;
@@ -217,6 +218,19 @@ public abstract class CompilerTests {
}
@Test
+ @Ignore("WIP")
+ public void genericMethods() throws Exception {
+ assertEquals(
+ value("two"),
+ execTestProgram(
+ "generic-method",
+ ScalarType.of("com.example.GenericMethod"),
+ "value",
+ list(),
+ Types.STRING));
+ }
+
+ @Test
public void genericInterfacesWithGenericTypeParameterAsReturnType() throws Exception {
assertEquals(
value("Hello"),
diff --git a/src/test/resources/java/generic-method/com/example/GenericMethod.java b/src/test/resources/java/generic-method/com/example/GenericMethod.java
new file mode 100644
index 0000000..f149efa
--- /dev/null
+++ b/src/test/resources/java/generic-method/com/example/GenericMethod.java
@@ -0,0 +1,11 @@
+package com.example;
+
+public class GenericMethod {
+ public static String value() {
+ return second("one", "two");
+ }
+
+ private static <T> T second(T first, T second) {
+ return second;
+ }
+}