Browse Source

test: add tokenize test

main
fdai7381 2 years ago
parent
commit
bc6bd9034a
  1. 13
      src/parse.rs

13
src/parse.rs

@ -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"]
);
}
}
Loading…
Cancel
Save