Browse Source

test: add tokenize test

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

15
src/parse.rs

@ -13,4 +13,17 @@ pub fn parse_line(line: &str) -> (&str, Vec<&str>) {
fn tokenize(line: &str) -> 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