mirror of
https://github.com/textmate/textmate.git
synced 2026-02-14 08:24:56 -05:00
22 lines
713 B
C++
22 lines
713 B
C++
#include <text/tokenize.h>
|
|
|
|
class TokenizeTests : public CxxTest::TestSuite
|
|
{
|
|
std::string replace_token (std::string const& str, char token, std::string const& replacement)
|
|
{
|
|
std::vector<std::string> v;
|
|
citerate(component, text::tokenize(str.begin(), str.end(), token))
|
|
v.push_back(*component);
|
|
return text::join(v, replacement);
|
|
}
|
|
|
|
public:
|
|
void test_tokenize ()
|
|
{
|
|
TS_ASSERT_EQUALS(replace_token( "foo/bar", '/', " » "), "foo » bar" );
|
|
TS_ASSERT_EQUALS(replace_token("/foo/bar", '/', " » "), " » foo » bar" );
|
|
TS_ASSERT_EQUALS(replace_token( "foo/bar/", '/', " » "), "foo » bar » ");
|
|
TS_ASSERT_EQUALS(replace_token("/foo/bar/", '/', " » "), " » foo » bar » ");
|
|
}
|
|
};
|