[parser] Add a single pair test
This commit is contained in:
parent
d312c41dc7
commit
cf503838ae
1 changed files with 10 additions and 1 deletions
|
@ -11,7 +11,7 @@ extern crate sibiltypes;
|
||||||
use sibillexer::{Lex, Token};
|
use sibillexer::{Lex, Token};
|
||||||
use sibillexer::Result as LexerResult;
|
use sibillexer::Result as LexerResult;
|
||||||
use sibilparser::Parser;
|
use sibilparser::Parser;
|
||||||
use sibiltypes::{Obj, Sym};
|
use sibiltypes::{Obj, Pair, Sym};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn single_sym() {
|
fn single_sym() {
|
||||||
|
@ -21,3 +21,12 @@ fn single_sym() {
|
||||||
assert_eq!(parser.next(), Some(Ok(Obj::new(Sym::with_str("abc")))));
|
assert_eq!(parser.next(), Some(Ok(Obj::new(Sym::with_str("abc")))));
|
||||||
assert_eq!(parser.next(), None);
|
assert_eq!(parser.next(), None);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn single_pair() {
|
||||||
|
let tokens = vec![Ok(Lex::new(Token::LeftParen, "(", 0, 0)),
|
||||||
|
Ok(Lex::new(Token::RightParen, ")", 0, 0))].into_iter();
|
||||||
|
let mut parser = Parser::new(tokens);
|
||||||
|
assert_eq!(parser.next(), Some(Ok(Obj::new(Pair::empty()))));
|
||||||
|
assert_eq!(parser.next(), None);
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue