diff options
author | JJ | 2023-04-13 22:13:07 +0000 |
---|---|---|
committer | JJ | 2023-04-13 22:13:07 +0000 |
commit | b10f8403f74fb01b34362aa288e41d54c4743f99 (patch) | |
tree | 33863e0c72e947949e3cae256c6a858780c20cea /tests | |
parent | 07448425a0e3c946dacf9d71a49de69f8cc30f58 (diff) |
trash previous parser + lexer
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()); -} |