From 0a00003ef006b0171220939fe35f96a4212e44d0 Mon Sep 17 00:00:00 2001 From: fdai7381 Date: Tue, 17 Jan 2023 09:56:13 +0100 Subject: [PATCH] test: add tokenize test --- src/parse.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/parse.rs b/src/parse.rs index ceef7e8..e6e3765 100644 --- a/src/parse.rs +++ b/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::>() -} \ No newline at end of file +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_tokenize() { + assert_eq!( + tokenize("test arg1 arg2 arg3"), + ["test", "arg1", "arg2", "arg3"] + ); + } +}