Skip to content

Commit

Permalink
Rework lambda to pass MSVC and GCC
Browse files Browse the repository at this point in the history
MSVC thinks you need the capture, GCC thinks the capture is not  needed, so pass variable directly into the lambda function call. Ugly to pass several booleans, but should work.

Signed-off-by: Kevin Wheatley <[email protected]>
  • Loading branch information
KevinJW committed Dec 20, 2024
1 parent eeb461d commit 09d0cbe
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions tests/cpu/OCIOZArchive_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ OCIO_ADD_TEST(OCIOZArchive, is_config_archivable)
cfg->clearSearchPaths();

// Lambda function to facilitate adding a new FileTransform to a config.
auto addFTAndTestIsArchivable = [&cfg, &minimal](const std::string & path, bool isArchivable)
auto addFTAndTestIsArchivable = [&cfg](const std::string & path, bool isArchivable, bool minimal)
{
std::string fullPath = pystring::os::path::join(path, "fake_lut.clf");
auto ft = OCIO::FileTransform::Create();
Expand All @@ -237,41 +237,41 @@ OCIO_ADD_TEST(OCIOZArchive, is_config_archivable)
*/

// Valid FileTransform path.
addFTAndTestIsArchivable("luts", true);
addFTAndTestIsArchivable(R"(luts/myluts1)", true);
addFTAndTestIsArchivable(R"(luts\myluts1)", true);
addFTAndTestIsArchivable("luts", true, false);
addFTAndTestIsArchivable(R"(luts/myluts1)", true, false);
addFTAndTestIsArchivable(R"(luts\myluts1)", true, false);

// Valid Search path starting with "./" or ".\".
addFTAndTestIsArchivable(R"(./myLuts)", true);
addFTAndTestIsArchivable(R"(.\myLuts)", true);
addFTAndTestIsArchivable(R"(./myLuts)", true, false);
addFTAndTestIsArchivable(R"(.\myLuts)", true, false);

// Valid search path starting with "./" or ".\" and a context variable.
addFTAndTestIsArchivable(R"(./$SHOT/myluts)", true);
addFTAndTestIsArchivable(R"(.\$SHOT\myluts)", true);
addFTAndTestIsArchivable(R"(luts/$SHOT)", true);
addFTAndTestIsArchivable(R"(luts/$SHOT/luts1)", true);
addFTAndTestIsArchivable(R"(luts\$SHOT)", true);
addFTAndTestIsArchivable(R"(luts\$SHOT\luts1)", true);
addFTAndTestIsArchivable(R"(./$SHOT/myluts)", true, false);
addFTAndTestIsArchivable(R"(.\$SHOT\myluts)", true, false);
addFTAndTestIsArchivable(R"(luts/$SHOT)", true, false);
addFTAndTestIsArchivable(R"(luts/$SHOT/luts1)", true, false);
addFTAndTestIsArchivable(R"(luts\$SHOT)", true, false);
addFTAndTestIsArchivable(R"(luts\$SHOT\luts1)", true, false);

/*
* Illegal scenarios
*/

// Illegal search path starting with "..".
addFTAndTestIsArchivable(R"(../luts)", false);
addFTAndTestIsArchivable(R"(..\myLuts)", false);
addFTAndTestIsArchivable(R"(../luts)", false, false);
addFTAndTestIsArchivable(R"(..\myLuts)", false, false);

// Illegal search path starting with a context variable.
addFTAndTestIsArchivable(R"($SHOT)", false);
addFTAndTestIsArchivable(R"($SHOT)", false, false);

// Illegal search path with absolute path.
addFTAndTestIsArchivable(R"(/luts)", false);
addFTAndTestIsArchivable(R"(/$SHOT)", false);
addFTAndTestIsArchivable(R"(/luts)", false, false);
addFTAndTestIsArchivable(R"(/$SHOT)", false, false);

#ifdef _WIN32
addFTAndTestIsArchivable(R"(C:\luts)", false);
addFTAndTestIsArchivable(R"(C:\)", false);
addFTAndTestIsArchivable(R"(\$SHOT)", false);
addFTAndTestIsArchivable(R"(C:\luts)", false, false);
addFTAndTestIsArchivable(R"(C:\)", false, false);
addFTAndTestIsArchivable(R"(\$SHOT)", false, false);
#endif
}
}
Expand Down

0 comments on commit 09d0cbe

Please sign in to comment.