diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_parser.rs | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/tests/test_parser.rs b/tests/test_parser.rs index f305483..9ac8f32 100644 --- a/tests/test_parser.rs +++ b/tests/test_parser.rs @@ -50,58 +50,3 @@ fn test_complex_annotations() { assert_eq!(parse_lambda("(lambda x. if x then 1: int else 0: int): (bool -> int)"), Ok(Ann(Abs("x", Cond(Var("x"), Ann(Const(Term::Natural(1)), Int), Ann(Const(Term::Natural(0)), Int))), Func(Bool, Int)))); assert_eq!(parse_lambda("(lambda x. if x then false else true): (bool -> bool)"), Ok(Ann(Abs("x", Cond(Var("x"), Const(Term::Boolean(false)), Const(Term::Boolean(true)))), Func(Bool, Bool)))); } - -const program: &'static str = -"func foo(x): (int -> int) = - if this = - that - else = - this - -hello -foo -bar -baz -func foo: (bool -> int) = - this -"; - -const lexed: &'static str = -"func foo(x): (int -> int) = { - if this = { - that; - }; - else = { - this; - }; -}; -hello; -foo; -bar; -baz; -func foo: (bool -> int) = { - this; -};"; - -#[test] -fn test_lexer() { - let result = lex(program); - assert!(result.is_ok()); - assert_eq!(result.unwrap(), lexed); -} - -#[test] -fn test_parser() { - let result = parse_lang(lexed); - assert!(result.is_err()); - - let file = std::fs::read_to_string("tests/src/negate.nim"); - assert!(file.is_ok()); - let result = parse_lang(&file.unwrap()); - assert!(result.is_err()); - - let file = std::fs::read_to_string("tests/src/fib.nim"); - assert!(file.is_ok()); - let result = parse_lang(&file.unwrap()); - assert!(result.is_err()); -} |