File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: 0755a30051c33c533ae2feb09924e561f7557143
2
+ refs/heads/master: 85bcf75da1a09fe52ce851ff8a288f0a819900d3
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ fn dirname(path p) -> path {
19
19
ret str:: substr ( p, 0 u, i as uint ) ;
20
20
}
21
21
22
+ // FIXME: Need some typestate to avoid bounds check when len(pre) == 0
22
23
fn connect ( path pre, path post) -> path {
23
24
auto len = str:: byte_len ( pre) ;
24
25
if ( pre. ( len - 1 u) == ( os_fs:: path_sep as u8 ) ) { // Trailing '/'?
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments