Skip to content

Commit fe026b2

Browse files
committed
test: skil URI tests on windows
there are a lot of caveats about them in https://www.sqlite.org/uri.html and I don't have the energy to deal with it today.
1 parent 1839dbd commit fe026b2

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

test/helper.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,9 @@ def i_am_running_in_valgrind
2121
# https://stackoverflow.com/questions/365458/how-can-i-detect-if-a-program-is-running-from-within-valgrind/62364698#62364698
2222
ENV["LD_PRELOAD"] =~ /valgrind|vgpreload/
2323
end
24+
25+
def windows?
26+
::RUBY_PLATFORM =~ /mingw|mswin/
27+
end
2428
end
2529
end

test/test_database_uri.rb

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,39 @@
55
module SQLite3
66
class TestDatabaseURI < SQLite3::TestCase
77
def test_open_absolute_file_uri
8+
skip("windows uri paths are hard") if windows?
9+
810
Tempfile.open "test.db" do |file|
9-
assert SQLite3::Database.new("file:#{file.path}")
11+
db = SQLite3::Database.new("file:#{file.path}")
12+
assert db
13+
db.close
1014
end
1115
end
1216

1317
def test_open_relative_file_uri
18+
skip("windows uri paths are hard") if windows?
19+
1420
Dir.mktmpdir do |dir|
1521
Dir.chdir dir do
16-
assert SQLite3::Database.new("file:test.db")
22+
db = SQLite3::Database.new("file:test.db")
23+
assert db
1724
assert_path_exists "test.db"
25+
db.close
1826
end
1927
end
2028
end
2129

2230
def test_open_file_uri_readonly
31+
skip("windows uri paths are hard") if windows?
32+
2333
Tempfile.open "test.db" do |file|
2434
db = SQLite3::Database.new("file:#{file.path}?mode=ro")
2535

2636
assert_raise(SQLite3::ReadOnlyException) do
2737
db.execute("CREATE TABLE foos (id integer)")
2838
end
39+
40+
db.close
2941
end
3042
end
3143
end

0 commit comments

Comments
 (0)