mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-25 22:50:25 -05:00
Python: Reject ambiguous generated enum names
This commit is contained in:
1 parent
51aa090668
commit
fb0b05958f
6 files changed
+88
-7
No files matched your search
@@ -37,6 +37,7 @@
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "cafMockObjects.h"
|
||||
#include "cafPdmDefaultObjectFactory.h"
|
||||
#include "cafPdmPythonGenerator.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -194,3 +195,21 @@ TEST( PdmPythonGenerator, DataTypeString_ChildField )
|
||||
caf::PdmPythonGenerator::dataTypeString( &obj.m_simpleObjPtrField, false ).toStdString().c_str() );
|
||||
EXPECT_STREQ( "str", caf::PdmPythonGenerator::dataTypeString( &obj.m_simpleObjPtrField, true ).toStdString().c_str() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
TEST( PdmPythonGenerator, ReportsAmbiguousEnumClassNames )
|
||||
{
|
||||
InheritedDemoObj::setUseAmbiguousEnumField( true );
|
||||
|
||||
caf::PdmPythonGenerator generator;
|
||||
std::vector<QString> errorMessages;
|
||||
generator.generate( caf::PdmDefaultObjectFactory::instance(), errorMessages );
|
||||
|
||||
InheritedDemoObj::setUseAmbiguousEnumField( false );
|
||||
|
||||
ASSERT_EQ( 1u, errorMessages.size() );
|
||||
EXPECT_TRUE( errorMessages.front().contains( "MyAppEnumValue" ) );
|
||||
EXPECT_TRUE( errorMessages.front().contains( "AlternativeEnumValue" ) );
|
||||
EXPECT_TRUE( errorMessages.front().contains( "PdmScriptEnumNameRegistry" ) );
|
||||
}
|
||||
Reference in new issue
Block a user