From: Siraaj Khandkar Date: Thu, 24 May 2018 01:46:33 +0000 (-0400) Subject: Add another test case X-Git-Url: https://git.xandkar.net/?a=commitdiff_plain;h=cb00a20dd1203e44609285b3e14e0e28cef2c06c;p=tiger.ml.git Add another test case --- diff --git a/tiger/src/exe/tiger_tests.ml b/tiger/src/exe/tiger_tests.ml index b76f368..3b1a0c2 100644 --- a/tiger/src/exe/tiger_tests.ml +++ b/tiger/src/exe/tiger_tests.ml @@ -129,6 +129,23 @@ let test_04 = in (name, code, tokens) +let test_09 = + let name = "error : types of then - else differ" in + let code = + " + /* "^name^" */ + + if (5>4) then 13 else \" \" + " + in + let tokens = + let open Tiger.Parser.Token in + [ IF; LPAREN; INT 5; GT; INT 4; RPAREN; THEN; INT 13; ELSE; STRING " " + ] + in + (* TODO: Type error test case *) + (name, code, tokens) + let tokens_of_code code = let lexbuf = Lexing.from_string code in let rec tokens () = @@ -143,6 +160,7 @@ let tests = ; test_02 ; test_03 ; test_04 + ; test_09 ] let () =