-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #160 from nlnwa/refactor/everything
refactor!
- Loading branch information
Showing
131 changed files
with
5,451 additions
and
3,484 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
*.warc.gz filter=lfs diff=lfs merge=lfs -text | ||
testdata/nedlib/nb-image/b863a630196bce1a15ca86b40f34a2d5 filter=lfs diff=lfs merge=lfs -text | ||
testdata/nedlib/nb-image/e4a2d28bdf4c38b8f6f291f7c8c958d5 filter=lfs diff=lfs merge=lfs -text | ||
*.meta filter=lfs diff=lfs merge=lfs -text | ||
*.gz filter=lfs diff=lfs merge=lfs -text | ||
*.warc filter=lfs diff=lfs merge=lfs -text | ||
*.arc filter=lfs diff=lfs merge=lfs -text | ||
*.meta filter=lfs diff=lfs merge=lfs -text | ||
/testdata/** 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
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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# Default binary | ||
warchaeology | ||
|
||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
|
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 |
---|---|---|
|
@@ -28,7 +28,6 @@ linters: | |
- containedctx | ||
- cyclop | ||
- depguard | ||
- errname | ||
- errorlint | ||
- err113 | ||
- exhaustive | ||
|
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
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
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,53 @@ | ||
package arcreader | ||
|
||
import ( | ||
"context" | ||
"path/filepath" | ||
"testing" | ||
|
||
"github.com/nlnwa/gowarc" | ||
"github.com/nlnwa/warchaeology/internal/warc" | ||
"github.com/spf13/afero" | ||
) | ||
|
||
var ( | ||
testDataDir = filepath.Join("..", "testdata") | ||
) | ||
|
||
var testFiles = map[string]string{ | ||
// from https://archive.org/details/SAMPLE_ARC_WHITEHOUSE | ||
"sample_arc_whitehouse": filepath.Join(testDataDir, "arc", "ARC-SAMPLE-20060928223931-00000-gojoblack.arc.gz"), | ||
} | ||
|
||
func TestArcReader(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
}{ | ||
{ | ||
name: "sample_arc_whitehouse", | ||
}, | ||
} | ||
for _, test := range tests { | ||
t.Run(test.name, func(t *testing.T) { | ||
// resolve test file path | ||
testFile, err := filepath.Abs(testFiles[test.name]) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
arcFileReader, err := NewArcFileReader(afero.NewReadOnlyFs(afero.NewOsFs()), testFile, 0, | ||
gowarc.WithBufferTmpDir(t.TempDir()), | ||
gowarc.WithStrictValidation(), | ||
) | ||
if err != nil { | ||
t.Fatalf("unexpected error: %v", err) | ||
} | ||
|
||
for record := range warc.NewIterator(context.Background(), arcFileReader, nil, 0, 0) { | ||
if record.Err != nil { | ||
t.Errorf("unexpected error: %v", record.Err) | ||
} | ||
} | ||
}) | ||
} | ||
} |
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
Oops, something went wrong.