mirror of
https://github.com/ipfs/kubo.git
synced 2025-10-12 01:06:38 +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)
|
|
}
|
|
}
|