Files
textmate/Frameworks/io/tests/t_attributes.cc
Allan Odgaard 9894969e67 Initial commit
2012-08-09 16:25:56 +02:00

34 lines
930 B
C++

#include <io/path.h>
#include <test/jail.h>
class AttributesTests : public CxxTest::TestSuite
{
public:
void test_attributes ()
{
test::jail_t jail;
std::string const file = jail.path("dummy");
path::set_content(file, "«some content»");
path::set_attr(file, "foo", "bar");
path::set_attr(file, "buz", "jazz");
TS_ASSERT_EQUALS(path::get_attr(file, "foo"), "bar");
TS_ASSERT_EQUALS(path::get_attr(file, "buz"), "jazz");
std::map<std::string, std::string> newAttrs;
newAttrs.insert(std::make_pair("new", "value"));
newAttrs.insert(std::make_pair("foo", NULL_STR));
path::set_attributes(file, newAttrs);
TS_ASSERT_EQUALS(path::get_attr(file, "foo"), NULL_STR);
TS_ASSERT_EQUALS(path::get_attr(file, "buz"), "jazz");
TS_ASSERT_EQUALS(path::get_attr(file, "new"), "value");
TS_ASSERT_EQUALS(path::attributes(file).size(), 2);
TS_ASSERT_EQUALS(path::content(file), "«some content»");
}
};