use vibesql_types::SqlValue;
pub(crate) fn render_raise_message(value: SqlValue) -> String {
match value {
SqlValue::Null => String::new(),
other => other.to_string(),
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn renders_string_message_verbatim() {
assert_eq!(
render_raise_message(SqlValue::Varchar("value too big".into())),
"value too big"
);
}
#[test]
fn coerces_integer_message_to_text() {
assert_eq!(render_raise_message(SqlValue::Integer(42)), "42");
}
#[test]
fn renders_null_message_as_empty_string() {
assert_eq!(render_raise_message(SqlValue::Null), "");
}
}