From b10f8403f74fb01b34362aa288e41d54c4743f99 Mon Sep 17 00:00:00 2001 From: JJ Date: Thu, 13 Apr 2023 15:13:07 -0700 Subject: trash previous parser + lexer --- tests/test_parser.rs | 55 ---------------------------------------------------- 1 file changed, 55 deletions(-) (limited to 'tests') 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()); -} -- cgit v1.2.3-70-g09d2