diff options
author | Yohann Roussel <yroussel@google.com> | 2015-03-31 11:23:08 +0200 |
---|---|---|
committer | Yohann Roussel <yroussel@google.com> | 2015-04-08 19:08:52 +0200 |
commit | 55a3102e8f62e4315a4d653a6699316144e5728a (patch) | |
tree | 869b47e0cdd57b50b6781a6aff9dfc80f21f6d68 /jack-tests/tests/com/android/jack/frontend | |
parent | 2b7c5bdbe7a2af93ecbb429931ff64c780bc8cc2 (diff) | |
download | toolchain_jack-55a3102e8f62e4315a4d653a6699316144e5728a.tar.gz toolchain_jack-55a3102e8f62e4315a4d653a6699316144e5728a.tar.bz2 toolchain_jack-55a3102e8f62e4315a4d653a6699316144e5728a.zip |
Test duplicate classes compilation error
Bug: 19989019
Change-Id: I77e2d9d8a9465ed27f180bbc664f248c37dc9e33
Diffstat (limited to 'jack-tests/tests/com/android/jack/frontend')
3 files changed, 73 insertions, 0 deletions
diff --git a/jack-tests/tests/com/android/jack/frontend/FrontEndTests.java b/jack-tests/tests/com/android/jack/frontend/FrontEndTests.java index 8018adea..a5692fbe 100644 --- a/jack-tests/tests/com/android/jack/frontend/FrontEndTests.java +++ b/jack-tests/tests/com/android/jack/frontend/FrontEndTests.java @@ -115,6 +115,37 @@ public class FrontEndTests { } /** + * Test that we do not crash and that we report the error. + */ + @Test + @Category(KnownBugs.class) + public void testDuplicated001() throws Exception { + File outDir = AbstractTestTools.createTempDir(); + + JackApiToolchainBase toolchain = + AbstractTestTools.getCandidateToolchain(JackApiToolchainBase.class); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + ByteArrayOutputStream err = new ByteArrayOutputStream(); + toolchain.setOutputStream(out); + toolchain.setErrorStream(err); + + try { + toolchain.addToClasspath(toolchain.getDefaultBootClasspath()) + .srcToLib( + outDir, + /* zipFiles= */ false, + AbstractTestTools.getTestRootDir("com.android.jack.frontend.test016.jack")); + Assert.fail(); + } catch (FrontendCompilationException e) { + Assert.assertEquals(0, out.size()); + String errString = err.toString(); + Assert.assertTrue(errString.contains("ERROR:")); + Assert.assertTrue(errString.contains("Duplicated")); + } + } + + + /** * Test that Jack is neither failing nor dropping warnings while ecj frontend is subject to skip * the local classes. */ diff --git a/jack-tests/tests/com/android/jack/frontend/test016/jack/Duplicated.java b/jack-tests/tests/com/android/jack/frontend/test016/jack/Duplicated.java new file mode 100644 index 00000000..41858c98 --- /dev/null +++ b/jack-tests/tests/com/android/jack/frontend/test016/jack/Duplicated.java @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2015 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.frontend.test016.jack; + +class Duplicated { + +} diff --git a/jack-tests/tests/com/android/jack/frontend/test016/jack/WithDuplicated.java b/jack-tests/tests/com/android/jack/frontend/test016/jack/WithDuplicated.java new file mode 100644 index 00000000..41858c98 --- /dev/null +++ b/jack-tests/tests/com/android/jack/frontend/test016/jack/WithDuplicated.java @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2015 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.frontend.test016.jack; + +class Duplicated { + +} |