summaryrefslogtreecommitdiffstats
path: root/jack-tests
diff options
context:
space:
mode:
authormikaelpeltier <mikaelpeltier@google.com>2014-09-15 10:53:54 +0200
committermikaelpeltier <mikaelpeltier@google.com>2014-09-15 11:00:21 +0200
commitfb97d18ee3fc038e40c167611be8884e40803d31 (patch)
tree633edfefe05c84d3c2e7a9ce7789a39cd2b2071e /jack-tests
parent63f38a100ed9b9c14788a87b8788ee95c564fd04 (diff)
downloadtoolchain_jack-fb97d18ee3fc038e40c167611be8884e40803d31.zip
toolchain_jack-fb97d18ee3fc038e40c167611be8884e40803d31.tar.gz
toolchain_jack-fb97d18ee3fc038e40c167611be8884e40803d31.tar.bz2
Create used variable even if they are defined into dead code
Bug: 7398661 Change-Id: I3b4f965608ea438d3a0c97718533fc6e52b77253
Diffstat (limited to 'jack-tests')
-rw-r--r--jack-tests/Android.mk4
-rw-r--r--jack-tests/tests/com/android/jack/switchstatement/test006/dx/Tests.java1
-rw-r--r--jack-tests/tests/com/android/jack/switchstatement/test010/dx/Tests.java35
-rw-r--r--jack-tests/tests/com/android/jack/switchstatement/test010/jack/Switch010.java35
4 files changed, 72 insertions, 3 deletions
diff --git a/jack-tests/Android.mk b/jack-tests/Android.mk
index 2255157..c259f02 100644
--- a/jack-tests/Android.mk
+++ b/jack-tests/Android.mk
@@ -244,12 +244,12 @@ $(call declare-test-with-name,string/concat003)
$(call declare-test-with-name,switchstatement/test001)
$(call declare-test-with-name,switchstatement/test002)
$(call declare-test-with-name,switchstatement/test003)
-# TODO uncomment when bug 7439926 is corrected
-#$(call declare-test-with-name,switchstatement/test004)
+$(call declare-test-with-name,switchstatement/test004)
$(call declare-test-with-name,switchstatement/test005)
$(call declare-test-with-name,switchstatement/test006)
$(call declare-test-with-name,switchstatement/test007)
$(call declare-test-with-name,switchstatement/test008)
+$(call declare-test-with-name,switchstatement/test010)
# Synchronize
$(call declare-test-with-name,synchronize/test001)
diff --git a/jack-tests/tests/com/android/jack/switchstatement/test006/dx/Tests.java b/jack-tests/tests/com/android/jack/switchstatement/test006/dx/Tests.java
index 60e0aee..cc12486 100644
--- a/jack-tests/tests/com/android/jack/switchstatement/test006/dx/Tests.java
+++ b/jack-tests/tests/com/android/jack/switchstatement/test006/dx/Tests.java
@@ -19,7 +19,6 @@ package com.android.jack.switchstatement.test006.dx;
import com.android.jack.switchstatement.test006.jack.Switch;
import org.junit.Assert;
-import org.junit.Ignore;
import org.junit.Test;
/**
diff --git a/jack-tests/tests/com/android/jack/switchstatement/test010/dx/Tests.java b/jack-tests/tests/com/android/jack/switchstatement/test010/dx/Tests.java
new file mode 100644
index 0000000..091b01b
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/switchstatement/test010/dx/Tests.java
@@ -0,0 +1,35 @@
+/*
+ * 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.switchstatement.test010.dx;
+
+import com.android.jack.switchstatement.test010.jack.Switch010;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Tests about switches.
+ */
+public class Tests {
+
+ @Test
+ public void test1() {
+ Assert.assertEquals(0, Switch010.test(1, true));
+ Assert.assertEquals(2, Switch010.test(2, false));
+ Assert.assertEquals(3, Switch010.test(3, false));
+ }
+}
diff --git a/jack-tests/tests/com/android/jack/switchstatement/test010/jack/Switch010.java b/jack-tests/tests/com/android/jack/switchstatement/test010/jack/Switch010.java
new file mode 100644
index 0000000..1d46b14
--- /dev/null
+++ b/jack-tests/tests/com/android/jack/switchstatement/test010/jack/Switch010.java
@@ -0,0 +1,35 @@
+/*
+ * 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.switchstatement.test010.jack;
+
+
+public class Switch010 {
+
+ public static int test(int value, boolean b) {
+ switch (value) {
+ case 1:
+ if (b || true) {
+ return 0;
+ }
+ @SuppressWarnings("unused")
+ int i = value;
+ default:
+ i = value;
+ return i;
+ }
+ }
+}