Closed
Description
Posix pahs like "/foo//bar" should be normalized to "/foo/bar". (WIndows likely has similar issues). Here is a test case:
// rustc --test normalize.rs && ./normalize
use std;
use Path = path::Path;
macro_rules! assert_equal (($expected: expr, $actual: expr) =>
{
let a = $actual; // only evaluate the expressions once
let e = $expected;
if a != e
{
fail fmt!("Found '%?', but expected '%?'", a, e);
}
})
// TODO: add a windows version of this
#[cfg(unix)]
fn root() -> Path
{
path::from_str(~"/tmp/")
}
#[test]
fn tester()
{
let path = root();
let path = path.push("/hmm");
let path = path.normalize();
assert_equal!(~"/tmp/hmm", path.to_str());
}
Metadata
Metadata
Assignees
Labels
No labels