Skip to content

Commit

Permalink
Disable some tests for ASE, fix some others
Browse files Browse the repository at this point in the history
  • Loading branch information
vjt authored and metaskills committed Nov 17, 2012
1 parent 0e44bba commit 695c880
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
11 changes: 8 additions & 3 deletions test/client_test.rb
Expand Up @@ -25,8 +25,13 @@ class ClientTest < TinyTds::TestCase
end

it 'has getters for the tds version information (brittle since conf takes precedence)' do
assert_equal 9, @client.tds_version
assert_equal 'DBTDS_7_1 - Microsoft SQL Server 2000', @client.tds_version_info
if sybase_ase?
assert_equal 7, @client.tds_version # FIXME this depends on ENV['TINYTDS_UNIT_VERSION']
assert_equal 'DBTDS_5_0 - 5.0 SQL Server', @client.tds_version_info
else
assert_equal 9, @client.tds_version
assert_equal 'DBTDS_7_1 - Microsoft SQL Server 2000', @client.tds_version_info
end
end

it 'uses UTF-8 client charset/encoding by default' do
Expand Down Expand Up @@ -155,7 +160,7 @@ class ClientTest < TinyTds::TestCase
assert_match %r{connection failed}i, e.message, 'ignore if non-english test run'
end
assert_new_connections_work
end
end unless sybase_ase?

end

Expand Down
19 changes: 13 additions & 6 deletions test/result_test.rb
Expand Up @@ -185,8 +185,14 @@ class ResultTest < TinyTds::TestCase
identity = @client.execute("INSERT INTO [datatypes] ([varchar_50]) VALUES ('something')").insert
assert_equal seed, identity
end
end

end unless sybase_ase?
# On Sybase, sp_helpindex cannot be used inside a transaction, as
# The 'CREATE TABLE' command is not allowed within a multi-statement
# transaction in the 'tempdb' database.
#
# ...and sp_helpindex creates a temporary table #spindtab
#

it 'must be able to begin/commit transactions with raw sql' do
rollback_transaction(@client) do
@client.execute("BEGIN TRANSACTION").do
Expand Down Expand Up @@ -581,7 +587,7 @@ class ResultTest < TinyTds::TestCase
assert_equal [], @client.execute('').each
end

if sybase_ase?
if sqlserver?

it 'must not raise an error when severity is 10 or less' do
(1..10).to_a.each do |severity|
Expand All @@ -601,7 +607,7 @@ class ResultTest < TinyTds::TestCase
else

it 'raises an error' do
action = lambda { @client.execute("RAISERROR (N'Hello World', 16, 1)").do }
action = lambda { @client.execute("RAISERROR 50000 N'Hello World'").do }
assert_raise_tinytds_error(action) do |e|
assert_equal "Hello World", e.message
assert_equal 16, e.severity # predefined on ASE
Expand All @@ -625,7 +631,8 @@ class ResultTest < TinyTds::TestCase
it 'must error gracefully with bad table name' do
action = lambda { @client.execute('SELECT * FROM [foobar]').each }
assert_raise_tinytds_error(action) do |e|
assert_match %r|invalid object name.*foobar|i, e.message
pattern = sybase_ase? ? /foobar not found/ : %r|invalid object name.*foobar|i
assert_match pattern, e.message
assert_equal 16, e.severity
assert_equal 208, e.db_error_number
end
Expand Down Expand Up @@ -676,7 +683,7 @@ class ResultTest < TinyTds::TestCase
else
skip 'FreeTDS 0.91 and higher can only pass this test.'
end
end
end unless sybase_ase?

end

Expand Down

0 comments on commit 695c880

Please sign in to comment.