MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / single_quoted_is_string_literal

Function single_quoted_is_string_literal

nodedb-sql/src/resolver/expr/tests.rs:94–109  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

92/// `'userId'` is a single-quoted string literal.
93#[test]
94fn single_quoted_is_string_literal() {
95 let expr = first_select_expr("SELECT 'userId' FROM users");
96 match &expr {
97 Expr::Value(v) => match &v.value {
98 Value::SingleQuotedString(s) => assert_eq!(s, "userId"),
99 other => panic!("expected SingleQuotedString, got {other:?}"),
100 },
101 other => panic!("expected Value, got {other:?}"),
102 }
103 // And convert_value maps it to SqlValue::String.
104 let Expr::Value(v) = expr else { unreachable!() };
105 assert!(matches!(
106 convert_value(&v.value),
107 Ok(SqlValue::String(s)) if s == "userId"
108 ));
109}
110
111/// `Value::DoubleQuotedString` (non-Postgres dialect) falls through
112/// `convert_value` to `SqlError::Unsupported`. With PostgreSQL dialect

Callers

nothing calls this directly

Calls 1

first_select_exprFunction · 0.85

Tested by

no test coverage detected