Skip to content

Commit

Permalink
Fix for look parse test failing,
Browse files Browse the repository at this point in the history
added a test case for SplitStringEnvStyle and JoinStringEnvStyle.
  • Loading branch information
larochj committed Dec 12, 2024
1 parent 6c41780 commit d2ebf42
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/OpenColorIO/LookParse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ const LookParseResult::Options & LookParseResult::parse(const std::string & look
tokens.push_back(t);
}

if( vec.size() == 0 )
{
LookParseResult::Token t;
tokens.push_back(t);
}

m_options.push_back(tokens);
}

Expand Down
7 changes: 7 additions & 0 deletions tests/cpu/ParseUtils_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,10 @@ OCIO_ADD_TEST(ParseUtils, string_vec_to_int_vec)
OCIO_ADD_TEST(ParseUtils, split_string_env_style)
{
StringUtils::StringVec outputvec;
outputvec = OCIO::SplitStringEnvStyle("");
OCIO_CHECK_EQUAL(0, outputvec.size());
outputvec.clear();

outputvec = OCIO::SplitStringEnvStyle("This:is:a:test");
OCIO_CHECK_EQUAL(4, outputvec.size());
OCIO_CHECK_EQUAL("This", outputvec[0]);
Expand Down Expand Up @@ -485,6 +489,9 @@ OCIO_ADD_TEST(ParseUtils, join_string_env_style)
OCIO_CHECK_EQUAL( "This, is, a, test", OCIO::JoinStringEnvStyle(outputvec) );
outputvec.clear();

OCIO_CHECK_EQUAL( "", OCIO::JoinStringEnvStyle(outputvec) );
outputvec.clear();

outputvec = { "This:is", "a:test" };
OCIO_CHECK_EQUAL( "\"This:is\", \"a:test\"", OCIO::JoinStringEnvStyle(outputvec) );
outputvec.clear();
Expand Down

0 comments on commit d2ebf42

Please sign in to comment.