From 858885c9caa0bfa4c995c08eaf4c6034f3a1a530 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Sat, 9 Sep 2023 23:46:42 -0400 Subject: [PATCH] fix unit test --- src/compilerlib/pb_parsing_parser.mly | 3 +++ src/tests/unit-tests/parse_extend.ml | 14 ++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/compilerlib/pb_parsing_parser.mly b/src/compilerlib/pb_parsing_parser.mly index 949d250d..4737f190 100644 --- a/src/compilerlib/pb_parsing_parser.mly +++ b/src/compilerlib/pb_parsing_parser.mly @@ -93,6 +93,8 @@ %type extension_ %start reserved_ %type reserved_ +%start extend_ +%type extend_ %% @@ -113,6 +115,7 @@ option_ : option T_eof {$1} extension_range_list_ : extension_range_list T_eof {$1} extension_ : extension T_eof {$1} reserved_ : reserved T_eof {$1} +extend_ : extend T_eof {$1} /* (* Main protobuf symbol *) */ diff --git a/src/tests/unit-tests/parse_extend.ml b/src/tests/unit-tests/parse_extend.ml index 6e8efbf8..eff79f42 100644 --- a/src/tests/unit-tests/parse_extend.ml +++ b/src/tests/unit-tests/parse_extend.ml @@ -1,3 +1,5 @@ +module Pbpt = Pb_parsing_parse_tree + let parse s = Pb_parsing_parser.extend_ Pb_parsing_lexer.lexer (Lexing.from_string s) @@ -17,8 +19,8 @@ let () = :: [] -> assert (field_name = "i"); assert (field_number = 1); - assert (field_type = "int32"); - assert (field_options = []); + assert (field_type = `Int32); + assert (field_options = Pb_option.empty); assert (`Optional = field_label); () | _ -> (assert false : unit)); @@ -36,8 +38,8 @@ let () = ] -> assert (field_name = "i"); assert (field_number = 1); - assert (field_type = "int32"); - assert (field_options = []); + assert (field_type = `Int32); + assert (field_options = Pb_option.empty); assert (`Optional = field_label); let { Pbpt.field_name; @@ -50,8 +52,8 @@ let () = in assert (field_name = "j"); assert (field_number = 2); - assert (field_type = "double"); - assert (field_options = []); + assert (field_type = `Double); + assert (field_options = Pb_option.empty); assert (`Required = field_label); () | _ -> (assert false : unit));