Skip to content

Commit

Permalink
Remove non ascii file from repo, to fix broken go get
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Saloň authored and MichalSalon committed Jun 6, 2024
1 parent ee5b78e commit 2ac4336
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v1.0.19] - 2023-06-06

### Fixed
- `go get` would fail due to the `non–ascii.txt` file in one of the test cases. File is now created ad-hoc during the test and then cleaned up.

## [v0.12.19] - 2023-02-24

### Fixed
Expand Down
6 changes: 6 additions & 0 deletions src/archiveClient/handler_findFilesByRules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,12 @@ var findByRulesTestCases = []struct {
}

func TestFindFilesByRules(t *testing.T) {
def, err := createNonAsciiFile()
if err != nil {
t.Fatal(err)
}
defer def()

ctrl := gomock.NewController(t)
uxBlocks := mocks.NewMockUxBlocks(ctrl)
uxBlocks.EXPECT().PrintInfo(gomock.Any()).AnyTimes()
Expand Down
20 changes: 20 additions & 0 deletions src/archiveClient/handler_findGitFiles_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package archiveClient

import (
"context"
"os"
"testing"

"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -30,6 +31,12 @@ var findGitFilesTestCases = []struct {
}

func TestFindGitFiles(t *testing.T) {
def, err := createNonAsciiFile()
if err != nil {
t.Fatal(err)
}
defer def()

ctx := context.TODO()
for _, test := range findGitFilesTestCases {
t.Run(test.name+"-in-"+test.workingDir, func(t *testing.T) {
Expand All @@ -48,3 +55,16 @@ func TestFindGitFiles(t *testing.T) {
})
}
}

// creates a non ascii file and returns a function to clean it up afterward
// needs to be done like this, otherwise `go get` fails on "malformed file path"
func createNonAsciiFile() (func(), error) {
file, err := os.Create("./test/var/www/non–ascii.txt")
if err != nil {
return nil, err
}
return func() {
file.Close()
os.Remove(file.Name())
}, nil
}
Empty file.

0 comments on commit 2ac4336

Please sign in to comment.