diff --git a/tests/repl/test_signatures.rs b/tests/repl/test_signatures.rs index 32de87d6c7..7ff5df4641 100644 --- a/tests/repl/test_signatures.rs +++ b/tests/repl/test_signatures.rs @@ -339,6 +339,36 @@ fn table_annotations_with_extra_characters() -> TestResult { fail_test(input, expected) } +#[rstest] +fn one_of_annotations( + #[values( + ("cell-path, list", "a.b.c", "cell-path"), + ("cell-path, list", "[a.b.c d.e.f]", "list"), + ("closure, any", "{}", "closure"), + ("closure, any", "{a: 1}", "record"), + )] + annotation_data: (&str, &str, &str), +) -> TestResult { + let (types, argument, expected) = annotation_data; + + let input = format!("def run [t: one_of({types})] {{ $t }}; run {argument} | describe"); + run_test(&input, expected) +} + +#[test] +fn one_of_annotations_not_terminated() -> TestResult { + let input = "def run [t: one_of(binary, string] { $t }"; + let expected = "expected closing )"; + fail_test(input, expected) +} + +#[test] +fn one_of_annotations_with_extra_characters() -> TestResult { + let input = "def run [t: one_of(int, string)extra] {$t}"; + let expected = "Extra characters in the parameter name"; + fail_test(input, expected) +} + #[rstest] #[case("{ |a $a }")] #[case("{ |a, b $a + $b }")]