mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-03 06:27:45 +00:00
Fix split tests.
I added an additional regex dependency and converted strings to Vec<u8>'s for the assertions.
This commit is contained in:
parent
9cfe018e66
commit
0df4918f2d
2 changed files with 8 additions and 7 deletions
|
@ -1 +1 @@
|
||||||
DEPLIBS += rand regex
|
DEPLIBS += rand regex regex-syntax
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
extern crate rand;
|
extern crate rand;
|
||||||
|
extern crate regex_syntax;
|
||||||
extern crate regex;
|
extern crate regex;
|
||||||
|
|
||||||
use std::fs::{File, read_dir, remove_file};
|
use std::fs::{File, read_dir, remove_file};
|
||||||
|
@ -50,7 +51,7 @@ impl Glob {
|
||||||
files.sort();
|
files.sort();
|
||||||
let mut data: Vec<u8> = vec!();
|
let mut data: Vec<u8> = vec!();
|
||||||
for name in files.iter() {
|
for name in files.iter() {
|
||||||
data.extend(get_file_contents(name));
|
data.extend(get_file_contents(name).into_bytes());
|
||||||
}
|
}
|
||||||
data
|
data
|
||||||
}
|
}
|
||||||
|
@ -100,7 +101,7 @@ fn test_split_default() {
|
||||||
panic!();
|
panic!();
|
||||||
}
|
}
|
||||||
assert_eq!(glob.count(), 2);
|
assert_eq!(glob.count(), 2);
|
||||||
assert_eq!(glob.collate(), get_file_contents(name));
|
assert_eq!(glob.collate(), get_file_contents(name).into_bytes());
|
||||||
glob.remove_all();
|
glob.remove_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +114,7 @@ fn test_split_num_prefixed_chunks_by_bytes() {
|
||||||
panic!();
|
panic!();
|
||||||
}
|
}
|
||||||
assert_eq!(glob.count(), 10);
|
assert_eq!(glob.count(), 10);
|
||||||
assert_eq!(glob.collate(), get_file_contents(name));
|
assert_eq!(glob.collate(), get_file_contents(name).into_bytes());
|
||||||
glob.remove_all();
|
glob.remove_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +127,7 @@ fn test_split_str_prefixed_chunks_by_bytes() {
|
||||||
panic!();
|
panic!();
|
||||||
}
|
}
|
||||||
assert_eq!(glob.count(), 10);
|
assert_eq!(glob.count(), 10);
|
||||||
assert_eq!(glob.collate(), get_file_contents(name));
|
assert_eq!(glob.collate(), get_file_contents(name).into_bytes());
|
||||||
glob.remove_all();
|
glob.remove_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +140,7 @@ fn test_split_num_prefixed_chunks_by_lines() {
|
||||||
panic!();
|
panic!();
|
||||||
}
|
}
|
||||||
assert_eq!(glob.count(), 10);
|
assert_eq!(glob.count(), 10);
|
||||||
assert_eq!(glob.collate(), get_file_contents(name));
|
assert_eq!(glob.collate(), get_file_contents(name).into_bytes());
|
||||||
glob.remove_all();
|
glob.remove_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,6 +153,6 @@ fn test_split_str_prefixed_chunks_by_lines() {
|
||||||
panic!();
|
panic!();
|
||||||
}
|
}
|
||||||
assert_eq!(glob.count(), 10);
|
assert_eq!(glob.count(), 10);
|
||||||
assert_eq!(glob.collate(), get_file_contents(name));
|
assert_eq!(glob.collate(), get_file_contents(name).into_bytes());
|
||||||
glob.remove_all();
|
glob.remove_all();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue