@@ -16,6 +16,8 @@ import (
16
16
"github.com/stretchr/testify/assert"
17
17
)
18
18
19
+ const oneRowAffected = "(1 row affected)"
20
+
19
21
func TestConnectionStringFromSqlCmd (t * testing.T ) {
20
22
type connectionStringTest struct {
21
23
settings * ConnectSettings
@@ -159,7 +161,7 @@ func TestIncludeFileNoExecutions(t *testing.T) {
159
161
assert .Equal (t , "select 'string' as title" , s .batch .String (), "s.batch.String() after IncludeFile twobatchnoendinggo.sql false" )
160
162
bytes , err := os .ReadFile (file .Name ())
161
163
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" )
163
165
}
164
166
}
165
167
}
@@ -177,7 +179,7 @@ func TestIncludeFileProcessAll(t *testing.T) {
177
179
assert .Equal (t , "" , s .batch .String (), "s.batch.String() after IncludeFile twobatchwithgo.sql true" )
178
180
bytes , err := os .ReadFile (file .Name ())
179
181
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" )
181
183
}
182
184
file , err = os .CreateTemp ("" , "sqlcmdout" )
183
185
defer os .Remove (file .Name ())
@@ -189,7 +191,7 @@ func TestIncludeFileProcessAll(t *testing.T) {
189
191
assert .Equal (t , "" , s .batch .String (), "s.batch.String() after IncludeFile twobatchnoendinggo.sql true" )
190
192
bytes , err := os .ReadFile (file .Name ())
191
193
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" )
193
195
}
194
196
}
195
197
}
@@ -232,7 +234,7 @@ func TestExitInitialQuery(t *testing.T) {
232
234
if assert .NoError (t , err , "s.Run(once = true)" ) {
233
235
s .SetOutput (nil )
234
236
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" )
236
238
assert .Equal (t , 1200 , s .Exitcode , "ExitCode" )
237
239
}
238
240
0 commit comments