1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-30 20:35:38 +02:00

[dsf-gdb] Add expected message in MIMemoryTest.writeWithInvalidAddress

Change-Id: Id1f46c879669e3a428bbc8039ff6363be35a9cb6
Signed-off-by: Simon Marchi <simon.marchi@polymtl.ca>
This commit is contained in:
Simon Marchi 2015-02-19 11:46:17 -05:00 committed by Gerrit Code Review @ Eclipse.org
parent 18a8a45323
commit 7328220fe6

View file

@ -12,6 +12,8 @@
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests;
import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
@ -47,7 +49,6 @@ import org.eclipse.cdt.tests.dsf.gdb.framework.SyncUtil;
import org.eclipse.cdt.tests.dsf.gdb.launching.TestsPlugin;
import org.eclipse.cdt.utils.Addr64;
import org.eclipse.debug.core.model.MemoryByte;
import org.hamcrest.CoreMatchers;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@ -667,8 +668,13 @@ public class MIMemoryTest extends BaseTestCase {
fBaseAddress = new Addr64("0");
expectedException.expect(ExecutionException.class);
// Don't test the error message since it changes from one GDB version to another
// TODO: there is another test that does it, we could do it.
String expectedStr1 = "Cannot access memory at address";
// Error message for new -data-write-memory-bytes command
String expectedStr2 = "Could not write memory";
expectedException.expect(ExecutionException.class);
expectedException.expectMessage(anyOf(
containsString(expectedStr1),
containsString(expectedStr2)));
// Perform the test
try {
@ -965,9 +971,9 @@ public class MIMemoryTest extends BaseTestCase {
// Error message for new -data-write-memory-bytes command
String expectedStr2 = "Could not write memory";
expectedException.expect(ExecutionException.class);
expectedException.expectMessage(CoreMatchers.anyOf(
CoreMatchers.containsString(expectedStr1),
CoreMatchers.containsString(expectedStr2)));
expectedException.expectMessage(anyOf(
containsString(expectedStr1),
containsString(expectedStr2)));
// Perform the test
try {