Skip to content

Commit efbeacb

Browse files
committed
test: add on_exit cleanup hook to cursor_streaming_large_test setup and fix formatting
1 parent 4d8b93d commit efbeacb

5 files changed

Lines changed: 185 additions & 252 deletions

File tree

native/ecto_libsql/src/tests/error_handling_tests.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,9 +482,10 @@ async fn test_prepared_statement_with_parameter_mismatch() {
482482
// DATABASE FILE ERROR TESTS
483483
// ============================================================================
484484

485+
#[cfg(unix)]
485486
#[tokio::test]
486487
async fn test_create_db_invalid_permissions() {
487-
// Test with path that's definitely invalid
488+
// Test with path that's definitely invalid (Unix-specific: null bytes)
488489
let invalid_path = "\0invalid\0path.db"; // Null bytes in path
489490

490491
// Creating DB with invalid path should error, not panic
@@ -495,6 +496,20 @@ async fn test_create_db_invalid_permissions() {
495496
let _ = result;
496497
}
497498

499+
#[cfg(windows)]
500+
#[tokio::test]
501+
async fn test_create_db_invalid_permissions() {
502+
// Test with path that's definitely invalid (Windows-specific: invalid characters)
503+
let invalid_path = "COM1"; // Reserved device name on Windows
504+
505+
// Creating DB with invalid path should error, not panic
506+
let result = Builder::new_local(invalid_path).build().await;
507+
508+
// This should error due to invalid path, or succeed silently
509+
// The key is it doesn't panic
510+
let _ = result;
511+
}
512+
498513
#[tokio::test]
499514
async fn test_readonly_database_insert() {
500515
let db_path = setup_test_db();

test/connection_recovery_test.exs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ defmodule EctoLibSql.ConnectionRecoveryTest do
77

88
setup do
99
{:ok, state} = EctoLibSql.connect(database: ":memory:")
10+
11+
on_exit(fn ->
12+
EctoLibSql.disconnect([], state)
13+
end)
14+
1015
{:ok, state: state}
1116
end
1217

0 commit comments

Comments
 (0)