Enable some new path unit tests
This commit is contained in:
parent
769874d34b
commit
f67c370f29
|
@ -527,7 +527,7 @@ bool cArosPath::IsAbsolutePath(const TSTRING& in)
|
||||||
if (in[0] == '/')
|
if (in[0] == '/')
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (in.find(":/") != std::string::npos)
|
if (in.find(":") != std::string::npos)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -554,12 +554,13 @@ TSTRING cArosPath::AsNative( const TSTRING& in )
|
||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
|
|
||||||
int x = 1;
|
std::string::size_type drive = in.find_first_not_of("/");
|
||||||
for ( x; in[x] == '/' && x<in.length(); x++);
|
TSTRING out = (drive != std::string::npos) ? in.substr(drive) : in;
|
||||||
|
|
||||||
TSTRING out = in.substr(x);
|
|
||||||
TSTRING::size_type t = out.find_first_of('/');
|
TSTRING::size_type t = out.find_first_of('/');
|
||||||
out[t] = ':';
|
if(t != std::string::npos)
|
||||||
|
out[t] = ':';
|
||||||
|
else
|
||||||
|
out.append(":");
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,8 +118,6 @@ void TestDosIsAbsolute()
|
||||||
|
|
||||||
void testDosBackupName(const std::string& in, const std::string& expected)
|
void testDosBackupName(const std::string& in, const std::string& expected)
|
||||||
{
|
{
|
||||||
TCERR << "In: " << in << " | Expected: " << expected << " | Observed: " << cDosPath::BackupName(in) << std::endl;
|
|
||||||
|
|
||||||
TEST( expected == cDosPath::BackupName(in) );
|
TEST( expected == cDosPath::BackupName(in) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,13 +134,12 @@ void TestDosBackupName()
|
||||||
|
|
||||||
void testArosAsPosix(const std::string& in, const std::string& expected)
|
void testArosAsPosix(const std::string& in, const std::string& expected)
|
||||||
{
|
{
|
||||||
TCERR << "In: " << in << " | Expected: " << expected << " | Observed: " << cArosPath::AsPosix(in) << std::endl ;
|
|
||||||
TEST( expected == cArosPath::AsPosix(in) );
|
TEST( expected == cArosPath::AsPosix(in) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestArosAsPosix()
|
void TestArosAsPosix()
|
||||||
{
|
{
|
||||||
// testArosAsPosix("DH0:", "/DH0/");
|
testArosAsPosix("DH0:", "/DH0/");
|
||||||
testArosAsPosix("DH0:Foo", "/DH0/Foo");
|
testArosAsPosix("DH0:Foo", "/DH0/Foo");
|
||||||
testArosAsPosix("DH0:Foo/Bar", "/DH0/Foo/Bar");
|
testArosAsPosix("DH0:Foo/Bar", "/DH0/Foo/Bar");
|
||||||
|
|
||||||
|
@ -194,10 +191,8 @@ void RegisterSuite_File()
|
||||||
RegisterTest("File", "DosAsNative", TestDosAsNative);
|
RegisterTest("File", "DosAsNative", TestDosAsNative);
|
||||||
RegisterTest("File", "DosIsAbsolute", TestDosIsAbsolute);
|
RegisterTest("File", "DosIsAbsolute", TestDosIsAbsolute);
|
||||||
RegisterTest("File", "DosBackupName", TestDosBackupName);
|
RegisterTest("File", "DosBackupName", TestDosBackupName);
|
||||||
// TODO: Finish these
|
|
||||||
/*
|
|
||||||
RegisterTest("File", "ArosAsPosix", TestArosAsPosix);
|
RegisterTest("File", "ArosAsPosix", TestArosAsPosix);
|
||||||
RegisterTest("File", "ArosAsNative", TestArosAsNative);
|
RegisterTest("File", "ArosAsNative", TestArosAsNative);
|
||||||
RegisterTest("File", "ArosIsAbsolute", TestArosIsAbsolute);
|
RegisterTest("File", "ArosIsAbsolute", TestArosIsAbsolute);
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue