use super::common;
use common::test_scenario::TestScenario;
use linkrs_query::parser::Parser;
#[test]
fn test_drop_tag_index_execution_if_exists_missing() {
TestScenario::new()
.expect("Failed to create test scenario")
.setup_space("test_space")
.exec_ddl("DROP TAG INDEX IF EXISTS no_such_index")
.assert_success()
.exec_ddl("DROP TAG INDEX no_such_index")
.assert_error();
}
#[test]
fn test_drop_tag_index_execution_roundtrip() {
TestScenario::new()
.expect("Failed to create test scenario")
.setup_space("test_space")
.exec_ddl("CREATE TAG Indexed(name: STRING)")
.assert_success()
.exec_ddl("CREATE TAG INDEX idx_indexed ON Indexed(name)")
.assert_success()
.exec_ddl("DROP TAG INDEX IF EXISTS idx_indexed")
.assert_success()
.exec_ddl("DROP TAG INDEX idx_indexed")
.assert_error();
}
#[test]
fn test_drop_edge_index_execution_if_exists_missing() {
TestScenario::new()
.expect("Failed to create test scenario")
.setup_space("test_space")
.exec_ddl("DROP EDGE INDEX IF EXISTS no_such_index")
.assert_success()
.exec_ddl("DROP EDGE INDEX no_such_index")
.assert_error();
}
#[test]
fn test_drop_index_execution_if_exists_missing() {
let mut parser = Parser::new("DROP INDEX IF EXISTS no_such_index");
let result = parser.parse();
assert!(
result.is_ok(),
"DROP INDEX IF EXISTS should parse: {:?}",
result.err()
);
TestScenario::new()
.expect("Failed to create test scenario")
.setup_space("test_space")
.exec_ddl("DROP INDEX IF EXISTS no_such_index")
.assert_success()
.exec_ddl("DROP INDEX no_such_index")
.assert_error();
}