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
|
name: Go
|
||||||
on: [push]
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@ -27,7 +27,8 @@ jobs:
|
|||||||
- name: Build
|
- name: Build
|
||||||
run: go build -v .
|
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")
|
want, err := ioutil.ReadFile("testdata/tbl_types.xml")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, want, buf.Bytes())
|
require.Equal(t, string(want), buf.String())
|
||||||
}
|
}
|
||||||
|
@ -155,19 +155,22 @@ func (h *Helper) Source(handle string) *source.Source {
|
|||||||
|
|
||||||
srcFile, err := os.Open(fpath)
|
srcFile, err := os.Open(fpath)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer func() { assert.NoError(t, srcFile.Close()) }()
|
defer func() {assert.NoError(t, srcFile.Close())}()
|
||||||
|
|
||||||
destFile, err := ioutil.TempFile("", "*_"+filepath.Base(src.Location))
|
destFile, err := ioutil.TempFile("", "*_"+filepath.Base(src.Location))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer func() { assert.NoError(t, destFile.Close()) }()
|
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)
|
_, err = io.Copy(destFile, srcFile)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
src.Location = sqlite3.Prefix + destFile.Name()
|
src.Location = sqlite3.Prefix + destFileName
|
||||||
}
|
}
|
||||||
h.srcCache[handle] = src
|
h.srcCache[handle] = src
|
||||||
return src
|
return src
|
||||||
|
Loading…
Reference in New Issue
Block a user