1#[cfg(test)]
7use crate::lex::lex;
8#[cfg(test)]
9use crate::prelude::*;
10#[cfg(test)]
11use crate::scan::scan;
12
13#[test]
14fn scan_cmp() {
15 assert_eq!(
16 scan("hh \"hello world\"hhhhh hello\"hello there \" \"hello\"".to_string()),
17 vec![
18 "hh",
19 "hello world",
20 "hhhhh",
21 "hello",
22 "hello there ",
23 "hello"
24 ]
25 )
26}
27
28#[test]
29fn lex_cmp() {
30 for (right, left) in lex(scan("hh 43 \"Hello, world!\" 3.3".to_string()))
31 .iter()
32 .zip(vec![
33 Argument::String("hh".to_string()),
34 Argument::Integer(43),
35 Argument::String("Hello, world!".to_string()),
36 Argument::Float(3.3),
37 ])
38 {
39 assert_eq!(right, &left);
40 }
41}
42
43#[test]
44fn pop_arg() {
45 let mut arguments = vec![Argument::String("Hello, World!".to_string())];
46 arguments.pop_arg().unwrap();
47 arguments.pop_arg().unwrap_err();
48}
49
50#[test]
51fn parse() {
52 let console = Console::new(HashMap::new(), "");
53 console.parse("help \"hello, world\"".to_string()).unwrap();
54}