@@ -16,6 +16,8 @@ import (
1616 "github.com/stretchr/testify/assert"
1717)
1818
19+ const oneRowAffected = "(1 row affected)"
20+
1921func TestConnectionStringFromSqlCmd (t * testing.T ) {
2022 type connectionStringTest struct {
2123 settings * ConnectSettings
@@ -159,7 +161,7 @@ func TestIncludeFileNoExecutions(t *testing.T) {
159161 assert .Equal (t , "select 'string' as title" , s .batch .String (), "s.batch.String() after IncludeFile twobatchnoendinggo.sql false" )
160162 bytes , err := os .ReadFile (file .Name ())
161163 if assert .NoError (t , err , "os.ReadFile" ) {
162- assert .Equal (t , "100" + SqlcmdEol + SqlcmdEol + "string" + SqlcmdEol + SqlcmdEol + "100" + SqlcmdEol + SqlcmdEol , string (bytes ), "Incorrect output from Run" )
164+ assert .Equal (t , "100" + SqlcmdEol + SqlcmdEol + oneRowAffected + SqlcmdEol + "string" + SqlcmdEol + SqlcmdEol + oneRowAffected + SqlcmdEol + "100" + SqlcmdEol + SqlcmdEol + oneRowAffected + SqlcmdEol , string (bytes ), "Incorrect output from Run" )
163165 }
164166 }
165167 }
@@ -177,7 +179,7 @@ func TestIncludeFileProcessAll(t *testing.T) {
177179 assert .Equal (t , "" , s .batch .String (), "s.batch.String() after IncludeFile twobatchwithgo.sql true" )
178180 bytes , err := os .ReadFile (file .Name ())
179181 if assert .NoError (t , err , "os.ReadFile" ) {
180- assert .Equal (t , "100" + SqlcmdEol + SqlcmdEol + "string" + SqlcmdEol + SqlcmdEol , string (bytes ), "Incorrect output from Run" )
182+ assert .Equal (t , "100" + SqlcmdEol + SqlcmdEol + oneRowAffected + SqlcmdEol + "string" + SqlcmdEol + SqlcmdEol + oneRowAffected + SqlcmdEol , string (bytes ), "Incorrect output from Run" )
181183 }
182184 file , err = os .CreateTemp ("" , "sqlcmdout" )
183185 defer os .Remove (file .Name ())
@@ -189,7 +191,7 @@ func TestIncludeFileProcessAll(t *testing.T) {
189191 assert .Equal (t , "" , s .batch .String (), "s.batch.String() after IncludeFile twobatchnoendinggo.sql true" )
190192 bytes , err := os .ReadFile (file .Name ())
191193 if assert .NoError (t , err , "os.ReadFile" ) {
192- assert .Equal (t , "100" + SqlcmdEol + SqlcmdEol + "string" + SqlcmdEol + SqlcmdEol , string (bytes ), "Incorrect output from Run" )
194+ assert .Equal (t , "100" + SqlcmdEol + SqlcmdEol + oneRowAffected + SqlcmdEol + "string" + SqlcmdEol + SqlcmdEol + oneRowAffected + SqlcmdEol , string (bytes ), "Incorrect output from Run" )
193195 }
194196 }
195197 }
@@ -232,7 +234,7 @@ func TestExitInitialQuery(t *testing.T) {
232234 if assert .NoError (t , err , "s.Run(once = true)" ) {
233235 s .SetOutput (nil )
234236 o := buf .buf .String ()
235- assert .Equal (t , "1200 2100" + SqlcmdEol + SqlcmdEol , o , "Output" )
237+ assert .Equal (t , "1200 2100" + SqlcmdEol + SqlcmdEol + oneRowAffected + SqlcmdEol , o , "Output" )
236238 assert .Equal (t , 1200 , s .Exitcode , "ExitCode" )
237239 }
238240
0 commit comments