Skip to content

Commit

Permalink
don't error on identical moose enum item additions. fix format test
Browse files Browse the repository at this point in the history
ref #0000
  • Loading branch information
rwcarlsen committed Sep 20, 2018
1 parent ee6e0e2 commit 372b46b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
19 changes: 11 additions & 8 deletions framework/src/utils/MooseEnumBase.C
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,17 @@ MooseEnumBase::addEnumerationName(const std::string & name, const int & value)
void
MooseEnumBase::addEnumerationItem(const MooseEnumItem & item)
{
if (find(item.id()) != _items.end())
mooseError("The supplied id ",
item.id(),
" already exists in the enumeration, cannot not add '",
item,
"'.");
if (find(item.name()) != _items.end())
mooseError("The name '", item.name(), "' already exists in the enumeration.");
if (_items.count(item) == 0) // only error if the existing item is not identical to new item
{
if (find(item.id()) != _items.end())
mooseError("The supplied id ",
item.id(),
" already exists in the enumeration, cannot not add '",
item,
"'.");
if (find(item.name()) != _items.end())
mooseError("The name '", item.name(), "' already exists in the enumeration.");
}

_items.insert(item);
}
Expand Down
2 changes: 1 addition & 1 deletion test/tests/outputs/format/test_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def testLineInfo(self):
fname = fi.keys()[0]
# Clang seems to have the full path name for __FILE__
# gcc seems to just use the path that is given on the command line, which won't include "framework"
self.assertTrue(fname.endswith(os.path.join("src", "parser", "MooseSyntax.C")))
self.assertTrue(fname.endswith(os.path.join("src", "base", "Moose.C")), 'file "{}" found instead'.format(fname))
self.assertGreater(fi[fname], 0)

fi = adapt["tasks"]["set_adaptivity_options"]["file_info"]
Expand Down

0 comments on commit 372b46b

Please sign in to comment.