MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / test_ddl_error_cases

Function test_ddl_error_cases

graphlite/tests/ddl_shared_tests.rs:79–138  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

77
78#[test]
79fn test_ddl_error_cases() {
80 let fixture = get_shared_fixture();
81
82 // Test invalid schema names - parser vs executor level validation
83 // Different types of invalid names are caught at different levels
84
85 // Names with spaces should be caught by parser or executor
86 match fixture.query("CREATE SCHEMA \"invalid name with spaces\"") {
87 Ok(_) => panic!("Expected schema name with spaces to fail"),
88 Err(e) => {
89 // Accept either parse error or validation error
90 assert!(
91 e.contains("Parse error") || e.contains("Invalid schema name"),
92 "Expected parse error or validation error, got: {}",
93 e
94 );
95 }
96 }
97
98 // Empty schema names - might be caught by parser or validator
99 match fixture.query("CREATE SCHEMA \"\"") {
100 Ok(_) => panic!("Expected empty schema name to fail"),
101 Err(e) => {
102 // Accept either parse error or validation error
103 assert!(
104 e.contains("Parse error")
105 || e.contains("Invalid")
106 || e.contains("Validation error"),
107 "Expected parse error or validation error, got: {}",
108 e
109 );
110 }
111 }
112
113 // Test invalid graph names
114 fixture.assert_query_fails("CREATE GRAPH invalid_schema/graph_name", "not found");
115
116 // Empty graph names - might be caught by parser or validator
117 match fixture.query("CREATE GRAPH \"\"") {
118 Ok(_) => panic!("Expected empty graph name to fail"),
119 Err(e) => {
120 // Accept either parse error or validation error
121 assert!(
122 e.contains("Parse error")
123 || e.contains("Invalid")
124 || e.contains("Validation error"),
125 "Expected parse error or validation error, got: {}",
126 e
127 );
128 }
129 }
130
131 // Test dropping non-existent resources without IF EXISTS
132 fixture.assert_query_fails("DROP SCHEMA non_existent_schema_12345", "not found");
133
134 fixture.assert_query_fails(
135 "DROP GRAPH non_existent_schema/non_existent_graph",
136 "not found",

Callers

nothing calls this directly

Calls 3

get_shared_fixtureFunction · 0.85
queryMethod · 0.45
assert_query_failsMethod · 0.45

Tested by

no test coverage detected