|
@ -27,7 +27,7 @@ impl Builtin for Help { |
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
fn split_command(commands: &str) -> Vec<&str> {
|
|
|
fn split_command(commands: &str) -> Vec<&str> {
|
|
|
if !commands.is_empty() && commands.trim().len() >= 1 {
|
|
|
|
|
|
|
|
|
if commands.trim_start().len() >= 1 {
|
|
|
let splitted_command = commands.trim_start().splitn(2, " ").collect();
|
|
|
let splitted_command = commands.trim_start().splitn(2, " ").collect();
|
|
|
return splitted_command;
|
|
|
return splitted_command;
|
|
|
}
|
|
|
}
|
|
@ -38,7 +38,6 @@ fn split_command(commands: &str) -> Vec<&str> { |
|
|
mod tests {
|
|
|
mod tests {
|
|
|
use super::*;
|
|
|
use super::*;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
#[test]
|
|
|
fn test_split_command_split() {
|
|
|
fn test_split_command_split() {
|
|
|
let test_string1 = "Hallo, Marcel Davis 1&1.";
|
|
|
let test_string1 = "Hallo, Marcel Davis 1&1.";
|
|
@ -52,7 +51,9 @@ mod tests { |
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
#[test]
|
|
|
fn test_split_command_empty(){assert_eq!(split_command(""),vec!["",""])}
|
|
|
|
|
|
|
|
|
fn test_split_command_empty() {
|
|
|
|
|
|
assert_eq!(split_command(""), vec!["", ""]);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
#[test]
|
|
|
fn test_split_command_only_space() {
|
|
|
fn test_split_command_only_space() {
|
|
|