mirror of
https://github.com/neilotoole/sq.git
synced 2024-12-24 16:51:34 +03:00
Added go test to github action; fixed Windows test issues (#52)
* initial test of testing workflow * added .gitattributes for crlf issue on windows * testh was attempting to remove the copied sqlite3 file before it was closed by sqlite3.database.Close() * fiddling with .gitattributes to get line endings to work
This commit is contained in:
parent
26abe3eb6d
commit
27ff71516e
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# Set the default behavior, in case people don't have core.autocrlf set.
|
||||
* text=auto eol=lf
|
5
.github/workflows/go.yml
vendored
5
.github/workflows/go.yml
vendored
@ -1,5 +1,5 @@
|
||||
name: Go
|
||||
on: [push]
|
||||
on: [push, pull_request]
|
||||
|
||||
|
||||
jobs:
|
||||
@ -27,7 +27,8 @@ jobs:
|
||||
- name: Build
|
||||
run: go build -v .
|
||||
|
||||
|
||||
- name: Test
|
||||
run: go test -v ./cli/output/...
|
||||
|
||||
#
|
||||
#
|
||||
|
@ -103,5 +103,5 @@ func TestRecordWriter_TblTypes(t *testing.T) {
|
||||
|
||||
want, err := ioutil.ReadFile("testdata/tbl_types.xml")
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, want, buf.Bytes())
|
||||
require.Equal(t, string(want), buf.String())
|
||||
}
|
||||
|
@ -160,14 +160,17 @@ func (h *Helper) Source(handle string) *source.Source {
|
||||
destFile, err := ioutil.TempFile("", "*_"+filepath.Base(src.Location))
|
||||
require.NoError(t, err)
|
||||
defer func() {assert.NoError(t, destFile.Close())}()
|
||||
t.Cleanup(func() {
|
||||
assert.NoError(t, os.Remove(destFile.Name()))
|
||||
|
||||
destFileName := destFile.Name()
|
||||
|
||||
h.Cleanup.AddE(func() error {
|
||||
return os.Remove(destFileName)
|
||||
})
|
||||
|
||||
_, err = io.Copy(destFile, srcFile)
|
||||
require.NoError(t, err)
|
||||
|
||||
src.Location = sqlite3.Prefix + destFile.Name()
|
||||
src.Location = sqlite3.Prefix + destFileName
|
||||
}
|
||||
h.srcCache[handle] = src
|
||||
return src
|
||||
|
Loading…
Reference in New Issue
Block a user