String split renaming:
* Renamed str::split -> str::split_byte * Renamed str::splitn -> str::splitn_byte * Renamed str::split_func -> str::split * Renamed str::split_char -> str::split_char * Renamed str::split_chars_iter -> str::split_char_iter * Added u8::is_ascii * Fixed the behavior of str::split_str, so that it matches split_chars and split (i.e. ["", "XXX", "YYY", ""] == split_str(".XXX.YYY.", ".")) * Fixed str::split_byte and str::splitn_byte so that they handle splitting UTF-8 strings on a given UTF-8/ASCII byte and also handle "" as the others do
This commit is contained in:
parent
159aebc28b
commit
a3f5626ad1
10 changed files with 189 additions and 141 deletions
|
@ -199,7 +199,7 @@ fn check_error_patterns(props: test_props,
|
|||
|
||||
let next_err_idx = 0u;
|
||||
let next_err_pat = props.error_patterns[next_err_idx];
|
||||
for line: str in str::split(procres.stdout, '\n' as u8) {
|
||||
for line: str in str::split_byte(procres.stdout, '\n' as u8) {
|
||||
if str::find(line, next_err_pat) > 0 {
|
||||
#debug("found error pattern %s", next_err_pat);
|
||||
next_err_idx += 1u;
|
||||
|
@ -246,7 +246,7 @@ fn check_expected_errors(expected_errors: [errors::expected_error],
|
|||
// filename:line1:col1: line2:col2: *warning:* msg
|
||||
// where line1:col1: is the starting point, line2:col2:
|
||||
// is the ending point, and * represents ANSI color codes.
|
||||
for line: str in str::split(procres.stdout, '\n' as u8) {
|
||||
for line: str in str::split_byte(procres.stdout, '\n' as u8) {
|
||||
let was_expected = false;
|
||||
vec::iteri(expected_errors) {|i, ee|
|
||||
if !found_flags[i] {
|
||||
|
@ -349,7 +349,7 @@ fn split_maybe_args(argstr: option<str>) -> [str] {
|
|||
}
|
||||
|
||||
alt argstr {
|
||||
option::some(s) { rm_whitespace(str::split(s, ' ' as u8)) }
|
||||
option::some(s) { rm_whitespace(str::split_byte(s, ' ' as u8)) }
|
||||
option::none { [] }
|
||||
}
|
||||
}
|
||||
|
@ -411,7 +411,7 @@ fn output_base_name(config: config, testfile: str) -> str {
|
|||
let base = config.build_base;
|
||||
let filename =
|
||||
{
|
||||
let parts = str::split(fs::basename(testfile), '.' as u8);
|
||||
let parts = str::split_byte(fs::basename(testfile), '.' as u8);
|
||||
parts = vec::slice(parts, 0u, vec::len(parts) - 1u);
|
||||
str::connect(parts, ".")
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue