summaryrefslogtreecommitdiff
path: root/lib/bytes/bytes_example_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bytes/bytes_example_test.go')
-rw-r--r--lib/bytes/bytes_example_test.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/bytes/bytes_example_test.go b/lib/bytes/bytes_example_test.go
index 3d6a11b5..a74a57fb 100644
--- a/lib/bytes/bytes_example_test.go
+++ b/lib/bytes/bytes_example_test.go
@@ -7,6 +7,7 @@ package bytes
import (
"bytes"
"fmt"
+ "log"
"math"
"github.com/shuLhan/share/lib/ascii"
@@ -249,6 +250,24 @@ func ExampleMergeSpaces() {
// a
}
+func ExampleParseHexDump() {
+ var (
+ in = []byte("0000000 6548 6c6c 2c6f 7720 726f 646c 0021")
+
+ out []byte
+ err error
+ )
+
+ out, err = ParseHexDump(in)
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ fmt.Printf(`%s`, TrimNull(out))
+ // Output:
+ // Hello, world!
+}
+
func ExamplePrintHex() {
title := "PrintHex"
data := []byte("Hello, world !")