add unit test
This commit is contained in:
@ -317,3 +317,12 @@ func Test_KeyStorageAndLoading(t *testing.T) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func Test_BasicInvalidAddress(t *testing.T) {
|
||||
invalidAddr := strings.Repeat("x", 60)
|
||||
invalidAddr += ".b32.i2p"
|
||||
_, err := Lookup(invalidAddr)
|
||||
if err == nil {
|
||||
t.Fatal("Expected error for nonexistent address")
|
||||
}
|
||||
}
|
||||
|
5
Makefile
5
Makefile
@ -109,10 +109,13 @@ test-key-storage-incompat:
|
||||
test-key-storage-nonexistent:
|
||||
go test -v -run Test_KeyStorageAndLoading/LoadNonexistentFile
|
||||
|
||||
test-basic-invalid-address:
|
||||
go test -v -run Test_BasicInvalidAddress
|
||||
|
||||
# Aggregate targets
|
||||
test-all:
|
||||
go test -v ./...
|
||||
|
||||
test-subtests: test-newi2paddrfromstring-valid test-newi2paddrfromstring-invalid test-newi2paddrfromstring-base32 test-newi2paddrfromstring-empty test-newi2paddrfromstring-i2p-suffix test-i2paddr-base32-suffix test-i2paddr-base32-length test-desthashfromstring-valid test-desthashfromstring-invalid test-desthashfromstring-empty test-i2paddr-to-bytes-roundtrip test-i2paddr-to-bytes-comparison test-key-generation-and-handling-loadkeys test-key-generation-and-handling-storekeys-incompat test-key-generation-and-handling-storekeys test-key-storage-file test-key-storage-incompat test-key-storage-nonexistent
|
||||
|
||||
test: test-basic test-basic-lookup test-newi2paddrfromstring test-i2paddr test-desthashfromstring test-i2paddr-to-bytes test-key-generation-and-handling test-key-storage test-subtests test-all
|
||||
test: test-basic test-basic-lookup test-newi2paddrfromstring test-i2paddr test-desthashfromstring test-i2paddr-to-bytes test-key-generation-and-handling test-key-storage test-basic-invalid-address test-subtests test-all
|
Reference in New Issue
Block a user