From ca08118a6c92676c904622c3a4ffa3b825885dfc Mon Sep 17 00:00:00 2001 From: derekviera Date: Mon, 15 Feb 2021 17:06:52 -0500 Subject: [PATCH] Fix Broken Tests Looks like some tests broke from 1.4 branch to the 1.4.2 branch --- test/test_database.rb | 4 ++-- test/test_database_readonly.rb | 2 +- test/test_integration.rb | 4 ++-- test/test_statement.rb | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/test_database.rb b/test/test_database.rb index a6386300..c255ed85 100644 --- a/test/test_database.rb +++ b/test/test_database.rb @@ -58,9 +58,9 @@ def test_extended_error_code db.execute 'CREATE TABLE "employees" ("token" integer NOT NULL)' begin db.execute 'INSERT INTO employees (token) VALUES (NULL)' - rescue SQLite3::SQLException => e + rescue SQLite3::ConstraintException => e end - assert_equal 1, e.code + assert_equal 1299, e.code end def test_bignum diff --git a/test/test_database_readonly.rb b/test/test_database_readonly.rb index dbd542de..def34b22 100644 --- a/test/test_database_readonly.rb +++ b/test/test_database_readonly.rb @@ -28,7 +28,7 @@ def test_open_readonly_not_exists_database def test_insert_readonly_database @db = SQLite3::Database.new('test-readonly.db', :readonly => true) - assert_raise(SQLite3::SQLException) do + assert_raise(SQLite3::ReadOnlyException) do @db.execute("INSERT INTO foos (id) VALUES (12)") end end diff --git a/test/test_integration.rb b/test/test_integration.rb index b3fec5ec..d5ea3a53 100644 --- a/test/test_integration.rb +++ b/test/test_integration.rb @@ -473,7 +473,7 @@ def test_transaction_implicit_rollback @db.transaction @db.execute('create table bar (x CHECK(1 = 0))') assert @db.transaction_active? - assert_raises( SQLite3::SQLException ) do + assert_raises( SQLite3::ConstraintException ) do @db.execute("insert or rollback into bar (x) VALUES ('x')") end assert !@db.transaction_active? @@ -485,7 +485,7 @@ def test_interrupt func.result = x end - assert_raise( SQLite3::SQLException ) do + assert_raise( SQLite3::InterruptException ) do @db.execute "select abort(a) from foo" end end diff --git a/test/test_statement.rb b/test/test_statement.rb index ef65ee71..d78b35cd 100644 --- a/test/test_statement.rb +++ b/test/test_statement.rb @@ -11,7 +11,7 @@ def test_double_close_does_not_segv @db.execute 'CREATE TABLE "things" ("number" float NOT NULL)' stmt = @db.prepare 'INSERT INTO things (number) VALUES (?)' - assert_raises(SQLite3::SQLException) { stmt.execute(nil) } + assert_raises(SQLite3::ConstraintException) { stmt.execute(nil) } stmt.close @@ -29,7 +29,7 @@ def test_insert_duplicate_records stmt = @db.prepare("INSERT INTO things(name) VALUES(?)") stmt.execute('ruby') - exception = assert_raises(SQLite3::SQLException) { stmt.execute('ruby') } + exception = assert_raises(SQLite3::ConstraintException) { stmt.execute('ruby') } # SQLite 3.8.2 returns new error message: # UNIQUE constraint failed: *table_name*.*column_name* # Older versions of SQLite return: