leo/compiler/tests/syntax/identifiers/mod.rs

98 lines
2.6 KiB
Rust
Raw Normal View History

2021-02-02 07:26:56 +03:00
// Copyright (C) 2019-2021 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 <https://www.gnu.org/licenses/>.
use crate::parse_program;
#[test]
fn test_address_name_fail() {
2020-12-04 23:48:43 +03:00
let program_string = include_str!("address_fail.leo");
let syntax_error = parse_program(program_string).is_err();
assert!(syntax_error);
}
#[test]
fn test_console_name_fail() {
2020-12-04 23:48:43 +03:00
let program_string = include_str!("console_fail.leo");
let syntax_error = parse_program(program_string).is_err();
assert!(syntax_error);
}
#[test]
fn test_field_name_fail() {
2020-12-04 23:48:43 +03:00
let program_string = include_str!("field_fail.leo");
let syntax_error = parse_program(program_string).is_err();
assert!(syntax_error);
}
#[test]
fn test_group_name_fail() {
2020-12-04 23:48:43 +03:00
let program_string = include_str!("group_fail.leo");
let syntax_error = parse_program(program_string).is_err();
assert!(syntax_error);
}
#[test]
fn test_i8_name_fail() {
2020-12-04 23:48:43 +03:00
let program_string = include_str!("i8_fail.leo");
let syntax_error = parse_program(program_string).is_err();
assert!(syntax_error);
}
2020-09-03 06:24:21 +03:00
#[test]
fn test_input_name_fail() {
2020-12-04 23:48:43 +03:00
let program_string = include_str!("input_fail.leo");
let syntax_error = parse_program(program_string).is_err();
2020-09-03 06:24:21 +03:00
assert!(syntax_error);
}
#[test]
fn test_self_type_name_fail() {
2020-12-04 23:48:43 +03:00
let program_string = include_str!("self_type_fail.leo");
let syntax_error = parse_program(program_string).is_err();
assert!(syntax_error);
}
#[test]
fn test_self_keyword_name_fail() {
2020-12-04 23:48:43 +03:00
let program_string = include_str!("self_keyword_fail.leo");
let syntax_error = parse_program(program_string).is_err();
assert!(syntax_error);
}
#[test]
fn test_true_name_fail() {
2020-12-04 23:48:43 +03:00
let program_string = include_str!("true_fail.leo");
let syntax_error = parse_program(program_string).is_err();
assert!(syntax_error);
}
#[test]
fn test_u8_name_fail() {
2020-12-04 23:48:43 +03:00
let program_string = include_str!("u8_fail.leo");
let syntax_error = parse_program(program_string).is_err();
assert!(syntax_error);
}