use udl::lex::{CharIter, Token}; use udl::parse::parse_expression_document; #[test] pub fn test_lexer() { // let mut a = CharIter::new(source.chars()); // let lex = unsafe{a.lex().unwrap_unchecked()}; // for b in lex { // let str = match b { // Token::BracketOpening(_) => "BracketOpening", // Token::BracketClosing(_) => "BracketClosing", // Token::Semicolon(_) => "Semicolon", // Token::Colon(_) => "Colon", // Token::Comment(_) => "Comment", // Token::Diamond(_) => "Diamond", // Token::SequenceOpening(_) => "SequenceOpening", // Token::SequenceClosing(_) => "SequenceClosing", // Token::Word(_, _) => "Word", // Token::Quote(_, _) => "Quote", // Token::DirectiveOpening(_) => "DirectiveOpening", // Token::ClosingTagOpening(_) => "ClosingTagOpening", // Token::OpeningTagOpening(_) => "OpeningTagOpening", // Token::DirectiveClosing(_) => "DirectiveClosing", // Token::Whitespace(_) => "Whitespace", // Token::End(_) => "End", // }; // print!("{}\n", str); // } } #[test] pub fn test_arguments() { let source = "A text argument"; let document = parse_expression_document(source).unwrap(); assert_eq!(document.length(), 1); assert!(document.is_text()); let source = "{ k1: v1; k2: v2 }"; let document = parse_expression_document(source).unwrap(); assert_eq!(document.length(), 1); assert!(document.is_dictionary()); let source = "[ e1; e2; e3 ]"; let document = parse_expression_document(source).unwrap(); assert_eq!(document.length(), 1); assert!(document.is_sequence()); let source = "