io: implement path manipulation on windows
This commit is contained in:
36
io-test/io-units.c
Normal file
36
io-test/io-units.c
Normal file
@@ -0,0 +1,36 @@
|
||||
#include <CuTest.h>
|
||||
#include <blue/io/path.h>
|
||||
#include <blue/object/object.h>
|
||||
#include <blue/core/stringstream.h>
|
||||
|
||||
void test_path_1(CuTest *tc)
|
||||
{
|
||||
b_path *path = b_path_create_from_cstr("C:\\hello\\world\\");
|
||||
char buf[512];
|
||||
b_stringstream str;
|
||||
b_stringstream_begin(&str, buf, sizeof buf);
|
||||
|
||||
b_to_string(B_OBJECT(path), &str);
|
||||
|
||||
printf("%s\n", buf);
|
||||
|
||||
b_path *path2 = b_path_create_from_cstr("path1\\path2\\");
|
||||
b_path *path3 = b_path_create_from_cstr("path3\\path4\\");
|
||||
|
||||
b_path *paths[] = {path, path2, path3};
|
||||
|
||||
b_path *path4 = b_path_join(paths, sizeof paths / sizeof *paths);
|
||||
|
||||
b_stringstream_begin(&str, buf, sizeof buf);
|
||||
b_to_string(B_OBJECT(path4), &str);
|
||||
printf("%s\n", buf);
|
||||
}
|
||||
|
||||
CuSuite *get_all_tests(void)
|
||||
{
|
||||
CuSuite *suite = CuSuiteNew();
|
||||
|
||||
SUITE_ADD_TEST(suite, test_path_1);
|
||||
|
||||
return suite;
|
||||
}
|
||||
Reference in New Issue
Block a user