|
@ -14,3 +14,16 @@ pub fn parse_line(line: &str) -> (&str, Vec<&str>) { |
|
|
fn tokenize(line: &str) -> Vec<&str> {
|
|
|
fn tokenize(line: &str) -> Vec<&str> {
|
|
|
line.trim().split(' ').collect::<Vec<&str>>()
|
|
|
line.trim().split(' ').collect::<Vec<&str>>()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
|
|
mod tests {
|
|
|
|
|
|
use super::*;
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
fn test_tokenize() {
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
tokenize("test arg1 arg2 arg3"),
|
|
|
|
|
|
["test", "arg1", "arg2", "arg3"]
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|