File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 2
2
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5
- refs/heads/try: 2600db4778dac418309320bed235a1025d84c630
5
+ refs/heads/try: 69834646d2efd2170236b1f8db3a71c77e378c5b
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
Original file line number Diff line number Diff line change @@ -920,7 +920,7 @@ fn find(haystack: str, needle: str) -> option<uint> {
920
920
// Convert a byte position into a char position
921
921
// within a given string
922
922
fn b2c_pos ( ss : str , bpos : uint ) -> uint {
923
- assert bpos < len_bytes ( ss) ;
923
+ assert bpos == 0 u || bpos < len_bytes ( ss) ;
924
924
925
925
let ii = 0 u;
926
926
let cpos = 0 u;
@@ -1725,6 +1725,9 @@ mod tests {
1725
1725
#[ test]
1726
1726
fn test_find_bytes ( ) {
1727
1727
// byte positions
1728
+ assert ( find_bytes ( "banana" , "apple pie" ) == option:: none) ;
1729
+ assert ( find_bytes ( "" , "" ) == option:: some ( 0 u) ) ;
1730
+
1728
1731
let data = "ประเทศไทย中华Việt Nam" ;
1729
1732
assert ( find_bytes ( data, "" ) == option:: some ( 0 u) ) ;
1730
1733
assert ( find_bytes ( data, "ประเ" ) == option:: some ( 0 u) ) ;
@@ -1736,6 +1739,9 @@ mod tests {
1736
1739
#[ test]
1737
1740
fn test_find ( ) {
1738
1741
// char positions
1742
+ assert ( find ( "banana" , "apple pie" ) == option:: none) ;
1743
+ assert ( find ( "" , "" ) == option:: some ( 0 u) ) ;
1744
+
1739
1745
let data = "ประเทศไทย中华Việt Nam" ;
1740
1746
assert ( find ( data, "" ) == option:: some ( 0 u) ) ;
1741
1747
assert ( find ( data, "ประเ" ) == option:: some ( 0 u) ) ;
You can’t perform that action at this time.
0 commit comments