mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-04 08:17:40 +00:00
TEST: Add CxxTest ValueTraits for String
This allows pretty printing them when there is an assertion failure
This commit is contained in:
parent
154fab3952
commit
3b4e8a4eea
23
test/common/str-helper.h
Normal file
23
test/common/str-helper.h
Normal file
@ -0,0 +1,23 @@
|
||||
#ifndef TEST_COMMON_HELPER_H
|
||||
#define TEST_COMMON_HELPER_H
|
||||
|
||||
#include "common/str.h"
|
||||
|
||||
namespace CxxTest
|
||||
{
|
||||
CXXTEST_TEMPLATE_INSTANTIATION
|
||||
class ValueTraits<const Common::String &>
|
||||
{
|
||||
ValueTraits &operator=( const ValueTraits & );
|
||||
Common::String _str;
|
||||
|
||||
public:
|
||||
ValueTraits( const Common::String &value ) : _str( value ) {}
|
||||
ValueTraits( const ValueTraits &other ) : _str( other._str ) {}
|
||||
const char *asString( void ) const { return _str.c_str(); }
|
||||
};
|
||||
CXXTEST_COPY_CONST_TRAITS( Common::String &);
|
||||
CXXTEST_COPY_TRAITS( Common::String, const Common::String &);
|
||||
}
|
||||
|
||||
#endif
|
@ -3,6 +3,8 @@
|
||||
#include "common/str.h"
|
||||
#include "common/ustr.h"
|
||||
|
||||
#include "test/common/str-helper.h"
|
||||
|
||||
class StringTestSuite : public CxxTest::TestSuite
|
||||
{
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user