Skip to content

Commit

Permalink
fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
c-cube committed Sep 10, 2023
1 parent bcbe0db commit 858885c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/compilerlib/pb_parsing_parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@
%type <Pb_parsing_parse_tree.extension_range list> extension_
%start reserved_
%type <Pb_parsing_parse_tree.extension_range list> reserved_
%start extend_
%type <Pb_parsing_parse_tree.extend> extend_

%%

Expand All @@ -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 *) */

Expand Down
14 changes: 8 additions & 6 deletions src/tests/unit-tests/parse_extend.ml
Original file line number Diff line number Diff line change
@@ -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)

Expand All @@ -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));
Expand All @@ -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;
Expand All @@ -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));
Expand Down

0 comments on commit 858885c

Please sign in to comment.