-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Motivation Many top level commands are missing tests. This is a first step to add a test for `ls` with proper test data. # Changes This commit adds a very simple test for `ls` that checks that it does not crash when reading a file. # Future work Add more checks to the test so that it is even better at avoiding regressions. # Acknowledgements Thanks to Ilya Kreymer for providing the test data through issue #99
- Loading branch information
Showing
4 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.warc.gz filter=lfs diff=lfs merge=lfs -text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package ls | ||
|
||
import ( | ||
"path/filepath" | ||
"testing" | ||
|
||
"github.com/nlnwa/warchaeology/internal/filter" | ||
"github.com/spf13/afero" | ||
) | ||
|
||
func TestConfigReadFileWithError(t *testing.T) { | ||
testDataDir := filepath.Join("..", "..", "test-data") | ||
warcWithErrors := filepath.Join(testDataDir, "samsung-with-error", "rec-33318048d933-20240317162652059-0.warc.gz") | ||
config := &conf{} | ||
config.filter = filter.NewFromViper() | ||
config.files = []string{warcWithErrors} | ||
_ = config.readFile(afero.NewOsFs(), warcWithErrors) | ||
// TODO: check that the result contains the expected values | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Origin | ||
|
||
This file was provided by Ilya Kreymer through issue: https://github.com/nlnwa/warchaeology/issues/99#issuecomment-2012776966 |
3 changes: 3 additions & 0 deletions
3
test-data/samsung-with-error/rec-33318048d933-20240317162652059-0.warc.gz
Git LFS file not shown