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