gluesql_test_suite/function/
generate_uuid.rs

1use {
2    crate::*,
3    gluesql_core::{ast::DataType, error::TranslateError},
4};
5
6test_case!(generate_uuid, {
7    let g = get_tester!();
8
9    let test_cases = [(
10        "SELECT generate_uuid(0) as uuid",
11        Err(TranslateError::FunctionArgsLengthNotMatching {
12            name: "GENERATE_UUID".to_owned(),
13            expected: 0,
14            found: 1,
15        }
16        .into()),
17    )];
18
19    for (sql, expected) in test_cases {
20        g.test(sql, expected).await;
21    }
22
23    g.count("SELECT GENERATE_UUID()", 1).await;
24    g.count("VALUES (GENERATE_UUID())", 1).await;
25    g.type_match("SELECT GENERATE_UUID() as uuid", &[DataType::Uuid])
26        .await;
27    g.type_match("VALUES (GENERATE_UUID())", &[DataType::Uuid])
28        .await;
29});