From 372b46b87ed6c5417d827fdfa624fdc877da2a6a Mon Sep 17 00:00:00 2001 From: Robert Carlsen Date: Thu, 20 Sep 2018 10:02:11 -0600 Subject: [PATCH] don't error on identical moose enum item additions. fix format test ref #0000 --- framework/src/utils/MooseEnumBase.C | 19 +++++++++++-------- test/tests/outputs/format/test_json.py | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/framework/src/utils/MooseEnumBase.C b/framework/src/utils/MooseEnumBase.C index b3bbf477c577..6da2b4830415 100644 --- a/framework/src/utils/MooseEnumBase.C +++ b/framework/src/utils/MooseEnumBase.C @@ -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); } diff --git a/test/tests/outputs/format/test_json.py b/test/tests/outputs/format/test_json.py index 8976540e3d9a..4cbb74880ad3 100755 --- a/test/tests/outputs/format/test_json.py +++ b/test/tests/outputs/format/test_json.py @@ -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"]