mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-23 19:37:46 +08:00
26 lines
351 B
Go
26 lines
351 B
Go
package blocks
|
|
|
|
import "testing"
|
|
|
|
func TestBlocksBasic(t *testing.T) {
|
|
|
|
// Test empty data
|
|
empty := []byte{}
|
|
_, err := NewBlock(empty)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
// Test nil case
|
|
_, err = NewBlock(nil)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
// Test some data
|
|
_, err = NewBlock([]byte("Hello world!"))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|