update tests

This commit is contained in:
Bahex 2025-05-02 08:19:23 +03:00
parent 6dfb7912f5
commit d85db07c27

View File

@ -342,30 +342,30 @@ fn table_annotations_with_extra_characters() -> TestResult {
#[rstest] #[rstest]
fn one_of_annotations( fn one_of_annotations(
#[values( #[values(
("cell-path, list<cell-path>", "a.b.c", "cell-path"), ("(cell-path | list<cell-path>)", "a.b.c", "cell-path"),
("cell-path, list<cell-path>", "[a.b.c d.e.f]", "list<cell-path>"), ("(cell-path | list<cell-path>)", "[a.b.c d.e.f]", "list<cell-path>"),
("closure, any", "{}", "closure"), ("(closure | any)", "{}", "closure"),
("closure, any", "{a: 1}", "record<a: int>"), ("(closure | any)", "{a: 1}", "record<a: int>"),
)] )]
annotation_data: (&str, &str, &str), annotation_data: (&str, &str, &str),
) -> TestResult { ) -> TestResult {
let (types, argument, expected) = annotation_data; let (one_of_type, argument, expected) = annotation_data;
let input = format!("def run [t: one_of({types})] {{ $t }}; run {argument} | describe"); let input = format!("def run [t: {one_of_type}] {{ $t }}; run {argument} | describe");
run_test(&input, expected) run_test(&input, expected)
} }
#[test] #[test]
fn one_of_annotations_not_terminated() -> TestResult { fn one_of_annotations_not_terminated() -> TestResult {
let input = "def run [t: one_of(binary, string] { $t }"; let input = "def run [t: (binary | string] { $t }";
let expected = "expected closing )"; let expected = "expected closing )";
fail_test(input, expected) fail_test(input, expected)
} }
#[test] #[test]
fn one_of_annotations_with_extra_characters() -> TestResult { fn one_of_annotations_with_extra_characters() -> TestResult {
let input = "def run [t: one_of(int, string)extra] {$t}"; let input = "def run [t: (int | string)extra] {$t}";
let expected = "Extra characters in the parameter name"; let expected = "Unknown type.";
fail_test(input, expected) fail_test(input, expected)
} }