Skip to content

Commit

Permalink
update r741
Browse files Browse the repository at this point in the history
  • Loading branch information
srz-zumix committed Nov 14, 2014
1 parent 6b91491 commit 16cbc5e
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 21 deletions.
2 changes: 1 addition & 1 deletion doc/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = iutest
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 1.10.99.38
PROJECT_NUMBER = 1.10.99.39

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
3 changes: 2 additions & 1 deletion include/impl/iutest_env.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ IUTEST_IPP_INLINE ::std::string TestEnv::get_report_xml_filepath(void)
if(option.find("xml") != ::std::string::npos)
{
const ::std::string::size_type pos = option.find("xml:");
if(pos != ::std::string::npos)
if(pos != ::std::string::npos
&& option.length() > pos + 4)
{
return option.substr(pos + 4);
}
Expand Down
9 changes: 0 additions & 9 deletions include/impl/iutest_filepath.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -244,15 +244,6 @@ IUTEST_IPP_INLINE iuFilePath iuFilePath::ConcatPaths(const iuFilePath& directory
return iuFilePath(path);
}

IUTEST_IPP_INLINE char iuFilePath::GetPathSeparator(void) IUTEST_CXX_NOEXCEPT_SPEC
{
#ifdef IUTEST_OS_WINDOWS
return '\\';
#else
return '/';
#endif
}

IUTEST_IPP_INLINE void iuFilePath::Normalize(void)
{
const char* src = c_str();
Expand Down
9 changes: 9 additions & 0 deletions include/impl/iutest_port.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,15 @@ IUTEST_PRAGMA_CRT_SECURE_WARN_DISABLE_END()
namespace detail
{

IUTEST_IPP_INLINE char GetPathSeparator(void) IUTEST_CXX_NOEXCEPT_SPEC
{
#ifdef IUTEST_OS_WINDOWS
return '\\';
#else
return '/';
#endif
}

IUTEST_IPP_INLINE bool SetEnvironmentVariable(const char* name, const char* value)
{
#if defined(IUTEST_OS_WINDOWS) && !defined(IUTEST_OS_WINDOWS_MOBILE) && !defined(IUTEST_OS_WINDOWS_PHONE) && !defined(IUTEST_OS_WINDOWS_RT)
Expand Down
6 changes: 0 additions & 6 deletions include/internal/iutest_filepath.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,6 @@ class iuFilePath
*/
static iuFilePath ConcatPaths(const iuFilePath& directory, const iuFilePath& relative_path);

public:
/**
* @brief パス区切り文字の取得
*/
static char GetPathSeparator(void) IUTEST_CXX_NOEXCEPT_SPEC;

private:
/**
* @biref 正規化
Expand Down
5 changes: 5 additions & 0 deletions include/internal/iutest_port.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ namespace detail

namespace posix = internal::posix;

/**
* @brief パス区切り文字の取得
*/
char GetPathSeparator(void) IUTEST_CXX_NOEXCEPT_SPEC;

/**
* @brief 環境変数の設定
*/
Expand Down
4 changes: 2 additions & 2 deletions include/iutest_ver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@

//======================================================================
// define
#define IUTEST_VER 0x01109938u //!< iutest version 1.10.99.38
#define IUTEST_VER 0x01109939u //!< iutest version 1.10.99.39
#define IUTEST_MAJORVER 0x01u //!< Major Version
#define IUTEST_MINORVER 0x10u //!< Minor Version
#define IUTEST_BUILD 0x99u //!< Build
#define IUTEST_REVISION 0x38u //!< Revision
#define IUTEST_REVISION 0x39u //!< Revision

/**
* @mainpage
Expand Down
6 changes: 4 additions & 2 deletions include/listener/iutest_default_xml_generator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ class DefaultXmlGeneratorListener : public EmptyTestEventListener
else
{
m_output_path = path;
if( path.find('.') == ::std::string::npos )
const ::std::string::size_type pos = path.find('.');
if( pos == ::std::string::npos
|| pos == path.length()-1 )
{
m_output_path += "\\";
m_output_path += detail::GetPathSeparator();
m_output_path += detail::kStrings::DefaultXmlReportFileName;
}
}
Expand Down
1 change: 1 addition & 0 deletions test/iutest_output_junit_xml_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ IUTEST(Fail, Test)
IUTEST(Foo, Bar)
{
IUTEST_ASSERT_EQ(3, 3);
IUTEST_SUCCEED();
}

IUTEST(Foo, Skip)
Expand Down
34 changes: 34 additions & 0 deletions test/iutest_output_xml_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,40 @@ int main(int argc, char* argv[])

FileIO::s_io.clear();
}

::iutest::IUTEST_FLAG(output) = "xml:.";
{
::iutest::IUTEST_FLAG(filter) = "*Fail*";
const int ret = IUTEST_RUN_ALL_TESTS();

if( ret == 0 ) return 1;
::std::string strXml = ".";
strXml += ::iutest::detail::GetPathSeparator();
strXml += ::iutest::detail::kStrings::DefaultXmlReportFileName;
IUTEST_ASSERT_EQ( strXml
, (reinterpret_cast< ::iutest::DefaultXmlGeneratorListener*>(::iutest::TestEnv::event_listeners().default_xml_generator())->GetFilePath()) )
<< ::iutest::AssertionReturn<int>(1);
IUTEST_ASSERT_NE(::std::string::npos, FileIO::s_io.find("Fail")) << FileIO::s_io << ::iutest::AssertionReturn<int>(1);
IUTEST_ASSERT_EQ(::std::string::npos, FileIO::s_io.find("Foo" )) << FileIO::s_io << ::iutest::AssertionReturn<int>(1);

FileIO::s_io.clear();
}

::iutest::IUTEST_FLAG(output) = "xml:";
{
::iutest::IUTEST_FLAG(filter) = "*Fail*";
const int ret = IUTEST_RUN_ALL_TESTS();

if( ret == 0 ) return 1;
IUTEST_ASSERT_EQ( ::iutest::detail::kStrings::DefaultXmlReportFileName
, (reinterpret_cast< ::iutest::DefaultXmlGeneratorListener*>(::iutest::TestEnv::event_listeners().default_xml_generator())->GetFilePath()) )
<< ::iutest::AssertionReturn<int>(1);
IUTEST_ASSERT_NE(::std::string::npos, FileIO::s_io.find("Fail")) << FileIO::s_io << ::iutest::AssertionReturn<int>(1);
IUTEST_ASSERT_EQ(::std::string::npos, FileIO::s_io.find("Foo" )) << FileIO::s_io << ::iutest::AssertionReturn<int>(1);

FileIO::s_io.clear();
}

{
::iutest::IUTEST_FLAG(default_package_name) = "root";
::iutest::IUTEST_FLAG(filter) = NULL;
Expand Down

0 comments on commit 16cbc5e

Please sign in to comment.