Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Commit

Permalink
add unset examle
Browse files Browse the repository at this point in the history
  • Loading branch information
andri-de committed Oct 30, 2017
1 parent 97bd93e commit 0ad781e
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions example_byteslice_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package byteslice

import "fmt"
import (
"fmt"
"log"
)

func ExampleReverse() {
data := []byte{0x55, 0xDA, 0xBA}
Expand All @@ -11,7 +14,18 @@ func ExampleReverse() {

func ExampleLPad() {
data := []byte{0x55, 0xDA, 0xBA}

fmt.Printf("%x\n", LPad(data, 5, 0x22))
// Output: 222255daba
}

func ExampleUnset() {
data1 := []byte{0x00, 0x00}
data2 := []byte{0x00}
val, err := Unset(data1, data2)
if err == nil || val != nil {
log.Println("Unset with two byte slices of different size needs to return an error and no value")
}
fmt.Printf("%x\n", val)
// Output: []
}

0 comments on commit 0ad781e

Please sign in to comment.