Fix tests
This commit is contained in:
parent
178434171e
commit
f37ab80163
@ -1,5 +1,6 @@
|
||||
use std::fmt::Debug;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct TokenError {
|
||||
pub msg: String,
|
||||
}
|
||||
@ -10,6 +11,7 @@ impl TokenError {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ParseError {
|
||||
pub msg: String,
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
use std::fmt;
|
||||
|
||||
use schala_lang::tokenizer::{Token, Kw, OpTok};
|
||||
use schala_lang::tokenizer::Token::*;
|
||||
use language::ProgrammingLanguage;
|
||||
|
||||
use std::fmt;
|
||||
use std::collections::VecDeque;
|
||||
use std::rc::Rc;
|
||||
use std::convert::From;
|
||||
@ -551,7 +554,7 @@ pub fn parse(tokens: &[Token], _parsed_tree: &[Statement]) -> ParseResult<AST> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use tokenizer;
|
||||
use schala_lang::tokenizer;
|
||||
use super::*;
|
||||
use super::Statement::*;
|
||||
use super::Expression::*;
|
||||
@ -610,7 +613,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn lambda_parse_test() {
|
||||
use tokenizer;
|
||||
use schala_lang::tokenizer;
|
||||
let t1 = "(fn(x) { x + 2 })";
|
||||
let tokens1 = tokenizer::tokenize(t1).unwrap();
|
||||
match parse(&tokens1, &[]).unwrap()[..] {
|
||||
@ -624,7 +627,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn conditional_parse_test() {
|
||||
use tokenizer;
|
||||
use schala_lang::tokenizer;
|
||||
let t1 = "if null { 20 } else { 40 }";
|
||||
let tokens = tokenizer::tokenize(t1).unwrap();
|
||||
match parse(&tokens, &[]).unwrap()[..] {
|
||||
|
@ -5,7 +5,7 @@ use std::str::Chars;
|
||||
use self::itertools::Itertools;
|
||||
use std::rc::Rc;
|
||||
|
||||
use language::TokenError;
|
||||
use language::{TokenError, ProgrammingLanguage};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Token {
|
||||
|
Loading…
Reference in New Issue
Block a user