steino / odbc

Automatically exported from code.google.com/p/odbc
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

do not panic during TestMSSQLType #24

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Ignore Explicit Instructions to modify the Test file to include the 
TDS_Version.
2. Run the tests.

What is the expected output? What do you see instead?

1. I expect to see a list of failed tests with some (maybe even vague) 
explanation.

2. I see:

$ go test -mssrv=internal-db-dev -msdb=test_database -msuser=username 
-mspass=password -run=MS
> --- FAIL: TestMSSQLTypes (0.01 seconds)
> panic: interface conversion: interface is nil, not bool [recovered]
>   panic: interface conversion: interface is nil, not bool
> 
> goroutine 8 [running]:
> testing.func·004()
>   /usr/lib/go/src/pkg/testing/testing.go:348 +0xcd
> code.google.com/p/odbc.func·005(0x4f7b40, 0xc200076f00, 0x1, 0x1)
>   ~/go/src/code.google.com/p/odbc/mssql_test.go:431 +0x239
> code.google.com/p/odbc.TestMSSQLTypes(0xc20009a1b0)
>   ~/go/src/code.google.com/p/odbc/mssql_test.go:636 +0x79e
> testing.tRunner(0xc20009a1b0, 0x811310)
>   /usr/lib/go/src/pkg/testing/testing.go:353 +0x8a
> created by testing.RunTests
>   /usr/lib/go/src/pkg/testing/testing.go:433 +0x86b
> 
> goroutine 1 [chan receive]:
> testing.RunTests(0x580e38, 0x8112e0, 0xd, 0xd, 0x1, ...)
>   /usr/lib/go/src/pkg/testing/testing.go:434 +0x88e
> testing.Main(0x580e38, 0x8112e0, 0xd, 0xd, 0x820360, ...)
>   /usr/lib/go/src/pkg/testing/testing.go:365 +0x8a
> main.main()
>   code.google.com/p/odbc/_test/_testmain.go:69 +0x9a
> 
> goroutine 2 [syscall]:
> exit status 2
> FAIL  code.google.com/p/odbc  0.247s

What version of the product are you using? On what operating system?

Most Recent Version of odbc as of 10/17/2013
Using unixODBC (installed as per your instructions)
Using FreeTDS (installed as per your instructoins)
Using Ubuntu 13.04

Please provide any additional information below.

Replacing all the direct type assertions in `match` from:

     got := a.(ACTUALTYPE)

to

     got, ok := a.(ACTUALTYPE)
     if !ok {
       return fmt.Errorf("Couldn't Convert Expected Value %s(%T) to %T, a, a, got)
     }

Would fix it and result in a better, more informative test suite. 

Original issue reported on code.google.com by Christop...@gmail.com on 17 Oct 2013 at 5:36

GoogleCodeExporter commented 9 years ago
Sure. Please review here https://codereview.appspot.com/14940043/. Thank you.

Alex

Original comment by alex.bra...@gmail.com on 18 Oct 2013 at 6:06

GoogleCodeExporter commented 9 years ago
Looks good to me!

Original comment by Christop...@gmail.com on 18 Oct 2013 at 2:17

GoogleCodeExporter commented 9 years ago
This issue was closed by revision b58de7db8f7d.

Original comment by alex.bra...@gmail.com on 21 Oct 2013 at 12:14