MCPcopy Create free account
hub / github.com/apache/datafusion / test_custom_tokens

Function test_custom_tokens

datafusion/sql/src/parser.rs:2099–2126  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2097
2098 #[test]
2099 fn test_custom_tokens() {
2100 // Span mock.
2101 let span = Span {
2102 start: Location { line: 0, column: 0 },
2103 end: Location { line: 0, column: 0 },
2104 };
2105 let tokens = vec![
2106 TokenWithSpan {
2107 token: Token::make_keyword("SELECT"),
2108 span,
2109 },
2110 TokenWithSpan {
2111 token: Token::Whitespace(Whitespace::Space),
2112 span,
2113 },
2114 TokenWithSpan {
2115 token: Token::Placeholder("1".to_string()),
2116 span,
2117 },
2118 ];
2119
2120 let statements = DFParserBuilder::new(tokens)
2121 .build()
2122 .unwrap()
2123 .parse_statements()
2124 .unwrap();
2125 assert_eq!(statements.len(), 1);
2126 }
2127
2128 fn expect_parse_expr_ok(sql: &str, expected: ExprWithAlias) {
2129 let expr = DFParser::parse_sql_into_expr(sql).unwrap();

Callers

nothing calls this directly

Calls 3

newFunction · 0.85
parse_statementsMethod · 0.80
buildMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…