Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 7eeea769d5
Fetching contributors…

Cannot retrieve contributors at this time

52 lines (43 sloc) 1.828 kB
open Common
open OUnit
open Ast_fuzzy_opa
module Ast = Ast_fuzzy_opa
module Flag = Flag_parsing_opa
(*****************************************************************************)
(* Helpers *)
(*****************************************************************************)
(*****************************************************************************)
(* Unit tests *)
(*****************************************************************************)
let unittest =
"parsing_opa" >::: [
(*-----------------------------------------------------------------------*)
(* Lexing *)
(*-----------------------------------------------------------------------*)
(* todo:
* - make sure parse int correctly, and float, and that actually does
* not return multiple tokens for 42.42
* - make sure string interpolation generates multiple tokens
* - ...
*)
(*-----------------------------------------------------------------------*)
(* Parsing *)
(*-----------------------------------------------------------------------*)
"regression files" >:: (fun () ->
let dir = Filename.concat Config.path "/tests/opa/parsing" in
let files = Common.glob (spf "%s/*.opa" dir) in
files +> List.iter (fun file ->
try
let (_, toks) = Parse_opa.parse_just_tokens file in
let toks = Ast_fuzzy_opa.toks_for_ast_fuzzy toks in
let tree = Token_views_opa.mk_tree toks in
let _tree = Ast_fuzzy_opa.mk_tree tree in
()
with Parse_opa.Parse_error _ ->
assert_failure (spf "it should correctly parse %s" file)
)
);
(*-----------------------------------------------------------------------*)
(* Misc *)
(*-----------------------------------------------------------------------*)
]
Jump to Line
Something went wrong with that request. Please try again.