Skip to content

Commit 9873553

Browse files
committed
---
yaml --- r: 2717 b: refs/heads/master c: 85bcf75 h: refs/heads/master i: 2715: 2954a19 v: v3
1 parent f8a9b7b commit 9873553

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 0755a30051c33c533ae2feb09924e561f7557143
2+
refs/heads/master: 85bcf75da1a09fe52ce851ff8a288f0a819900d3

trunk/src/lib/fs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ fn dirname(path p) -> path {
1919
ret str::substr(p, 0u, i as uint);
2020
}
2121

22+
// FIXME: Need some typestate to avoid bounds check when len(pre) == 0
2223
fn connect(path pre, path post) -> path {
2324
auto len = str::byte_len(pre);
2425
if (pre.(len - 1u) == (os_fs::path_sep as u8)) { // Trailing '/'?

trunk/src/test/run-pass/lib-fs.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
use std;
2+
3+
import std::fs;
4+
5+
fn test_connect() {
6+
auto slash = fs::path_sep();
7+
assert (fs::connect("a", "b")
8+
== "a" + slash + "b");
9+
assert (fs::connect("a" + slash, "b")
10+
== "a" + slash + "b");
11+
}
12+
13+
fn main() {
14+
test_connect();
15+
}

0 commit comments

Comments
 (0)