Test fixes

This commit is contained in:
dragonmacher 2021-03-23 12:52:08 -04:00
parent 8c71f06855
commit 1b36a099f4
2 changed files with 11 additions and 8 deletions

View file

@ -583,20 +583,22 @@ public class CodeBrowserOptionsTest extends AbstractGhidraHeadedIntegrationTest
final int WORD_WRAP = 3; final int WORD_WRAP = 3;
final int MAX_LINES = 4; final int MAX_LINES = 4;
final int SHOW_REF_ADDR = 5; final int SHOW_REF_ADDR = 5;
final int SHOW_SEMICOLON = 6; //final int SHOW_FUNCTION_AUTO = 6;
final int SHOW_SEMICOLON = 7;
showTool(tool); showTool(tool);
loadProgram(); loadProgram();
Options options = tool.getOptions(GhidraOptions.CATEGORY_BROWSER_FIELDS); Options options = tool.getOptions(GhidraOptions.CATEGORY_BROWSER_FIELDS);
List<String> names = getOptionNames(options, "EOL Comments Field"); List<String> names = getOptionNames(options, "EOL Comments Field");
assertEquals(8, names.size()); assertEquals(9, names.size());
assertEquals(EolCommentFieldFactory.ENABLE_ALWAYS_SHOW_AUTOMATIC_MSG, names.get(0)); assertEquals(EolCommentFieldFactory.ENABLE_ALWAYS_SHOW_AUTOMATIC_MSG, names.get(0));
assertEquals(EolCommentFieldFactory.ENABLE_ALWAYS_SHOW_REF_REPEATABLE_MSG, names.get(1)); assertEquals(EolCommentFieldFactory.ENABLE_ALWAYS_SHOW_REF_REPEATABLE_MSG, names.get(1));
assertEquals(EolCommentFieldFactory.ENABLE_ALWAYS_SHOW_REPEATABLE_MSG, names.get(2)); assertEquals(EolCommentFieldFactory.ENABLE_ALWAYS_SHOW_REPEATABLE_MSG, names.get(2));
assertEquals(EolCommentFieldFactory.ENABLE_WORD_WRAP_MSG, names.get(3)); assertEquals(EolCommentFieldFactory.ENABLE_WORD_WRAP_MSG, names.get(3));
assertEquals(EolCommentFieldFactory.MAX_DISPLAY_LINES_MSG, names.get(4)); assertEquals(EolCommentFieldFactory.MAX_DISPLAY_LINES_MSG, names.get(4));
assertEquals(EolCommentFieldFactory.ENABLE_PREPEND_REF_ADDRESS_MSG, names.get(5)); assertEquals(EolCommentFieldFactory.ENABLE_PREPEND_REF_ADDRESS_MSG, names.get(5));
assertEquals(EolCommentFieldFactory.ENABLE_SHOW_SEMICOLON_MSG, names.get(6)); assertEquals(EolCommentFieldFactory.SHOW_FUNCTION_AUTOMITIC_COMMENT_MSG, names.get(6));
assertEquals(EolCommentFieldFactory.USE_ABBREVIATED_AUTOMITIC_COMMENT_MSG, names.get(7)); assertEquals(EolCommentFieldFactory.ENABLE_SHOW_SEMICOLON_MSG, names.get(7));
assertEquals(EolCommentFieldFactory.USE_ABBREVIATED_AUTOMITIC_COMMENT_MSG, names.get(8));
Address callAddress = addr("0x1003fcc"); Address callAddress = addr("0x1003fcc");
Address callRefAddress = addr("0x1006642"); Address callRefAddress = addr("0x1006642");

View file

@ -2351,13 +2351,14 @@ public class SymbolManager implements SymbolTable, ManagerDB {
return; return;
} }
if (!(namespace instanceof NamespaceDB)) { Symbol symbol = namespace.getSymbol();
if (!(symbol instanceof SymbolDB)) {
// unexpected namespace type; all supported types will be db objects
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Namespace is not a valid parent for symbols: " + "Namespace is not a valid parent for symbols: " + namespace.getClass());
namespace.getClass());
} }
SymbolDB dbSymbol = (SymbolDB) namespace.getSymbol(); SymbolDB dbSymbol = (SymbolDB) symbol;
if (program != dbSymbol.getProgram()) { if (program != dbSymbol.getProgram()) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Namespace symbol is from a different program"); "Namespace symbol is from a different program");