Skip to content

Commit 7e00c97

Browse files
claykomlazysegtree
andauthored
fix: windows test ci (#941)
I've fixed the windows build test CI mentioned in issue #938, I adjusted the workflow to run on my branch to make sure it works, all tests passed. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit * **Tests** * Improved file compression and extraction tests with additional assertions and logging for better validation and debugging. * Enhanced test setup to skip empty directory paths, preventing unnecessary directory creation. * Refined shell substitution test to use a valid inner command while maintaining expected error handling. * **Chores** * Updated build and test workflow to use a runner-specific temporary directory for Go module caching, improving environment isolation. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Nitin Kumar <nknitinkumar12384@gmail.com>
1 parent 0dd32e7 commit 7e00c97

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

.github/workflows/superfile-build-test.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,25 @@ jobs:
3131
with:
3232
path: |
3333
~/.cache/go-build
34-
~/go/pkg/mod
34+
${{ runner.temp }}/gomodcache
3535
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
3636
restore-keys: |
3737
${{ runner.os }}-go-
3838
3939
- name: Install dependencies
4040
run: go mod download
41+
env:
42+
GOMODCACHE: ${{ runner.temp }}/gomodcache
4143

4244
- name: Build
43-
run: go build ./...
45+
run: go build -v ./...
46+
env:
47+
GOMODCACHE: ${{ runner.temp }}/gomodcache
4448

4549
- name: Test
4650
run: go test -v ./...
51+
env:
52+
GOMODCACHE: ${{ runner.temp }}/gomodcache
4753

4854
- name: Check gofmt (skip on Windows)
4955
if: runner.os != 'Windows'

src/internal/handle_file_operation_test.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,16 +125,27 @@ func TestCompressSelectedFiles(t *testing.T) {
125125
return err == nil
126126
}, time.Second, 10*time.Millisecond)
127127

128+
// Assert zip file exists right after compression
129+
require.FileExists(t, zipFile, "Expected zip file does not exist after compression")
130+
128131
// No-op update to get the filepanel updated
129132
// TODO - This should not be needed. Only operation finish SPF should refresh
130133
// on its own
131134
TeaUpdateWithErrCheck(t, &m, nil)
132135

133136
require.Greater(t, len(m.getFocusedFilePanel().element), tt.cursorIndexForZip)
134-
assert.Equal(t, zipFile, m.getFocusedFilePanel().element[tt.cursorIndexForZip].location,
137+
selectedItemLocation := m.getFocusedFilePanel().element[tt.cursorIndexForZip].location
138+
// Debug output for panel element
139+
t.Logf("Panel element at cursorIndexForZip: %s", selectedItemLocation)
140+
assert.Equal(t, zipFile, selectedItemLocation,
135141
"%s does not exists at index %d among %v", zipFile, tt.cursorIndexForZip,
136142
m.getFocusedFilePanel().element)
137143

144+
// Ensure we are extracting the zip file, not a directory
145+
fileInfo, err := os.Stat(selectedItemLocation)
146+
require.NoError(t, err, "Failed to stat panel location before extraction")
147+
require.False(t, fileInfo.IsDir(), "Panel location for extraction is a directory, expected a zip file: %s", selectedItemLocation)
148+
138149
m.getFocusedFilePanel().cursor = tt.cursorIndexForZip
139150

140151
TeaUpdateWithErrCheck(t, &m, utils.TeaRuneKeyMsg(common.Hotkeys.ExtractFile[0]))

src/internal/test_utils.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ var SampleDataBytes = []byte("This is sample") //nolint: gochecknoglobals // Eff
1919
func setupDirectories(t *testing.T, dirs ...string) {
2020
t.Helper()
2121
for _, dir := range dirs {
22+
if dir == "" {
23+
continue
24+
}
2225
err := os.MkdirAll(dir, 0755)
2326
require.NoError(t, err)
2427
}

src/internal/ui/prompt/tokenize_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func Test_resolveShellSubstitution(t *testing.T) {
128128
},
129129
{
130130
name: "Ill formed command 2",
131-
command: "abc $(abc) syt ${ sdfc ( {)}",
131+
command: "abc $(echo abc) syt ${ sdfc ( {)}",
132132
expectedResult: "",
133133
isErrorExpected: true,
134134
errorToMatch: curlyBracketMatchError(),

0 commit comments

Comments
 (0)