Skip to content

Commit

Permalink
feat(parser): add simple test for type annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
ksenmel committed Nov 17, 2024
1 parent 1a6411d commit 9846f65
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/tests/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(library
(name tests)
(modules test_parser)
(libraries arML_lib parser ast)
(inline_tests)
(preprocess
(pps ppx_expect ppx_deriving.show)))
14 changes: 14 additions & 0 deletions lib/tests/test_parser.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(* * Copyright 2024, raf-nr and ksenmel *)

(** SPDX-License-Identifier: LGPL-3.0-or-later *)

open Base

let run code =
match Parser.parse code with
| Ok ast -> Stdlib.Format.printf "%a\n" Ast.pp_program ast
| Error s -> Stdlib.Format.printf "Parsing error: %s\n" s
;;

let%expect_test "simple annotation" =
run "let (x : int) = 3" ;

0 comments on commit 9846f65

Please sign in to comment.