summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--jack-tests/Android.mk1
-rw-r--r--jack-tests/tests/com/android/jack/string/concat003/dx/Tests.java32
-rw-r--r--jack-tests/tests/com/android/jack/string/concat003/jack/Concat.java26
-rw-r--r--jack/tests/com/android/jack/ConcatTest.java6
4 files changed, 65 insertions, 0 deletions
diff --git a/jack-tests/Android.mk b/jack-tests/Android.mk
index bfefef65..1f191021 100644
--- a/jack-tests/Android.mk
+++ b/jack-tests/Android.mk
@@ -235,6 +235,7 @@ $(call declare-test,$(LOCAL_PATH)/tests/com/android/jack/shrob/test030/test.mk)
# String
$(call declare-test-with-name,string/concat001)
$(call declare-test-with-name,string/concat002)
+$(call declare-test-with-name,string/concat003)
# Switches
$(call declare-test-with-name,switchstatement/test001)
diff --git a/jack-tests/tests/com/android/jack/string/concat003/dx/Tests.java b/jack-tests/tests/com/android/jack/string/concat003/dx/Tests.java
new file mode 100644
index 00000000..b1895d14
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/string/concat003/dx/Tests.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.jack.string.concat003.dx;
+
+import com.android.jack.string.concat003.jack.Concat;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class Tests {
+
+ @Test
+ public void test1() {
+ String[] strings= new String[] {"ab"};
+ String str = "cd";
+ Assert.assertEquals(strings[0] + str, Concat.test(strings, str));
+ }
+}
diff --git a/jack-tests/tests/com/android/jack/string/concat003/jack/Concat.java b/jack-tests/tests/com/android/jack/string/concat003/jack/Concat.java
new file mode 100644
index 00000000..283edf51
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/string/concat003/jack/Concat.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.jack.string.concat003.jack;
+
+
+public class Concat {
+
+ public static String test(String[] strings, String str) {
+ strings[0] += str;
+ return strings[0];
+ }
+}
diff --git a/jack/tests/com/android/jack/ConcatTest.java b/jack/tests/com/android/jack/ConcatTest.java
index f733ad0f..df156fc0 100644
--- a/jack/tests/com/android/jack/ConcatTest.java
+++ b/jack/tests/com/android/jack/ConcatTest.java
@@ -37,4 +37,10 @@ public class ConcatTest {
TestTools.runCompilation(TestTools.buildCommandLineArgs(
TestTools.getJackTestsWithJackFolder("string/concat002")));
}
+
+ @Test
+ public void testCompile003() throws Exception {
+ TestTools.runCompilation(TestTools.buildCommandLineArgs(
+ TestTools.getJackTestsWithJackFolder("string/concat003")));
+ }
}