Check that names don’t start with special characters
This commit is contained in:
parent
d0263dd1c4
commit
2e3707e0af
@ -93,6 +93,21 @@ mod tests
|
||||
assert!(function_or_predicate_name("Predicate_123 rest").is_err());
|
||||
assert!(function_or_predicate_name("_ rest").is_err());
|
||||
assert!(function_or_predicate_name("_predicate_123 rest").is_err());
|
||||
assert!(function_or_predicate_name("(p").is_err());
|
||||
assert!(function_or_predicate_name(")p").is_err());
|
||||
assert!(function_or_predicate_name(">p").is_err());
|
||||
assert!(function_or_predicate_name("<p").is_err());
|
||||
assert!(function_or_predicate_name("=p").is_err());
|
||||
assert!(function_or_predicate_name(",p").is_err());
|
||||
assert!(function_or_predicate_name("+p").is_err());
|
||||
assert!(function_or_predicate_name("-p").is_err());
|
||||
assert!(function_or_predicate_name("*p").is_err());
|
||||
assert!(function_or_predicate_name("/p").is_err());
|
||||
assert!(function_or_predicate_name("%p").is_err());
|
||||
assert!(function_or_predicate_name("|p").is_err());
|
||||
assert!(function_or_predicate_name("#inf").is_err());
|
||||
assert!(function_or_predicate_name("#sup").is_err());
|
||||
assert!(function_or_predicate_name("#p").is_err());
|
||||
assert!(function_or_predicate_name(" ").is_err());
|
||||
// Keywords aren’t valid names
|
||||
assert!(function_or_predicate_name("and rest").is_err());
|
||||
@ -124,6 +139,21 @@ mod tests
|
||||
assert!(variable_name("variable_123 Rest").is_err());
|
||||
assert!(variable_name("_ Rest").is_err());
|
||||
assert!(variable_name("_variable_123 Rest").is_err());
|
||||
assert!(variable_name("(X").is_err());
|
||||
assert!(variable_name(")X").is_err());
|
||||
assert!(variable_name(">X").is_err());
|
||||
assert!(variable_name("<X").is_err());
|
||||
assert!(variable_name("=X").is_err());
|
||||
assert!(variable_name(",X").is_err());
|
||||
assert!(variable_name("+X").is_err());
|
||||
assert!(variable_name("-X").is_err());
|
||||
assert!(variable_name("*X").is_err());
|
||||
assert!(variable_name("/X").is_err());
|
||||
assert!(variable_name("%X").is_err());
|
||||
assert!(variable_name("|X").is_err());
|
||||
assert!(variable_name("#inf").is_err());
|
||||
assert!(variable_name("#sup").is_err());
|
||||
assert!(variable_name("#X").is_err());
|
||||
assert!(variable_name(" ").is_err());
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user