[parser] Integration test of parsing a single Sym!
This commit is contained in:
		
							parent
							
								
									9a728c9489
								
							
						
					
					
						commit
						d312c41dc7
					
				
					 2 changed files with 24 additions and 1 deletions
				
			
		
							
								
								
									
										23
									
								
								parser/tests/single_item.rs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								parser/tests/single_item.rs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
/* parser/tests/single_item.rs
 | 
			
		||||
 * Eryn Wells <eryn@erynwells.me>
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
//! Tests that the parser can handle inputs of single tokens.
 | 
			
		||||
 | 
			
		||||
extern crate sibillexer;
 | 
			
		||||
extern crate sibilparser;
 | 
			
		||||
extern crate sibiltypes;
 | 
			
		||||
 | 
			
		||||
use sibillexer::{Lex, Token};
 | 
			
		||||
use sibillexer::Result as LexerResult;
 | 
			
		||||
use sibilparser::Parser;
 | 
			
		||||
use sibiltypes::{Obj, Sym};
 | 
			
		||||
 | 
			
		||||
#[test]
 | 
			
		||||
fn single_sym() {
 | 
			
		||||
    let lex: LexerResult = Ok(Lex::new(Token::Id, "abc", 0, 0));
 | 
			
		||||
    let tokens = vec![lex].into_iter();
 | 
			
		||||
    let mut parser = Parser::new(tokens);
 | 
			
		||||
    assert_eq!(parser.next(), Some(Ok(Obj::new(Sym::with_str("abc")))));
 | 
			
		||||
    assert_eq!(parser.next(), None);
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue