From d6e0c0fdf80f482f4df73e33d4a35d2b7fd37e32 Mon Sep 17 00:00:00 2001 From: gluaxspeed Date: Thu, 21 Jan 2021 15:30:26 -0500 Subject: [PATCH] grammar annotated_tests tests --- grammar/tests/annotated_tests.rs | 43 +++++++++++++++++++++++++++++++ grammar/tests/annotated_tests.rs~ | 43 +++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 grammar/tests/annotated_tests.rs create mode 100644 grammar/tests/annotated_tests.rs~ diff --git a/grammar/tests/annotated_tests.rs b/grammar/tests/annotated_tests.rs new file mode 100644 index 0000000000..1fc9185cf1 --- /dev/null +++ b/grammar/tests/annotated_tests.rs @@ -0,0 +1,43 @@ +// Copyright (C) 2019-2020 Aleo Systems Inc. +// This file is part of the Leo library. + +// The Leo library is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// The Leo library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with the Leo library. If not, see . + +use leo_grammar::ast::{LanguageParser, Rule}; + +use pest::*; + +#[test] +fn test_annotation_no_context_test() { + parses_to! { + parser: LanguageParser, + input: "@test", + rule: Rule::annotation, + tokens: [ + annotation(0, 5, [annotation_symbol(0, 1, []), annotation_name(1, 5, [test(1, 5, [])])]) + ] + } +} + +#[test] +fn test_annotation_context_test() { + parses_to! { + parser: LanguageParser, + input: "@test(custom)", + rule: Rule::annotation, + tokens: [ + annotation(0, 13, [annotation_symbol(0, 1, []), annotation_name(1, 5, [test(1, 5, [])]), annotation_arguments(5, 13, [annotation_argument(6, 12, [])])]) + ] + } +} diff --git a/grammar/tests/annotated_tests.rs~ b/grammar/tests/annotated_tests.rs~ new file mode 100644 index 0000000000..a47908fad9 --- /dev/null +++ b/grammar/tests/annotated_tests.rs~ @@ -0,0 +1,43 @@ +// Copyright (C) 2019-2020 Aleo Systems Inc. +// This file is part of the Leo library. + +// The Leo library is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// The Leo library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with the Leo library. If not, see . + +use leo_grammar::ast::{LanguageParser, Rule}; + +use pest::*; + +#[test] +fn test_annotation_no_context_test() { + parses_to! { + parser: LanguageParser, + input: "@test", + rule: Rule::annotation, + tokens: [ + annotation(0, 5, [annotation_symbol(0, 1, []), annotation_name(1, 5, [test(1, 5, [])])]) + ] + } +} + +#[test] +fn test_annotation_context_test() { + parses_to! { + parser: LanguageParser, + input: "@test(custom)", + rule: Rule::annotation, + tokens: [ + annotation(0, 13, [annotation_symbol(0, 1, []), annotation_name(1, 5, [test(1, 5, [])]), annotation_arguments(5, 13, [annotation_argument(6, 12, [])])]) + ] + } +} \ No newline at end of file